views:

8791

answers:

6

I want to get IMEI on iPhone. I try to use the following code:


#import "Message/NetworkController.h"
NetworkController *ntc=[[NetworkController sharedInstance] autorelease];
NSString *imeistring = [ntc IMEI];

But NetworkController is not found.

I also find that I can get uniqueIdentifier using:


UIDevice *myDevice = [UIDevice currentDevice];
NSString *identifier = myDevice.uniqueIdentifier;

But this cannot help me to get IMEI.

Any suggestion about how to get IMEI on iPhone?

A: 

You can't find the IMEI programmatically on the iPhone.

Jane Sales
+1  A: 

I'm sure there are reasons you can't do this easily. Auto-unlocker app? I don't think so. I'm sure Apple and AT&T wouldn't like it too much either.

*#06# is the way to get it manually.

pyrochild
what is #06# ? Can you explain a little more?
iPhoney
dialing *#06# on all cell phones that I know of will show their IMEI.That's star-hash-zero-six-hash.
pyrochild
+3  A: 

There is no oficial way to get it, but....

in the apples private framework "CoreTelephony.framework" (Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/System/Library/PrivateFrameworks/CoreTelephony.framework)

There is a method __CTGetIMEI

If you know, how to work with private frameworks, it can help you. ;)

oxigen
I am using CoreTelephony frame in one of the apps. But unable to figure out how I can use __CTGetIMEI functions to get the IMEI number of the iPhone? Can you please help?
AJ
+5  A: 

I found that erica had posted the header file "Message/NetworkController.h" on ericasadun.com. http://ericasadun.com/iPhoneDocs300/_network_controller_8h-source.html (It's been removed now)

I created a header file, copy and paste the NetworkController.h file into it and add the private framework "Message.framework" to my project, import the header file I created.

Now I can use the original method I found to get the imei number.

NetworkController *ntc = [NetworkController sharedInstance];
NSString *imeistring = [ntc IMEI];
iPhoney
Erica has posted a new way to get IMEI here: http://github.com/erica/uidevice-extension/blob/master/UIDevice-IOKitExtensions.m
iPhoney
A: 

With the Given (http://ericasadun.com/iPhoneDocs300/_network_controller_8h-source.html) link I couldnt able to find the header file "Message/NetworkController.h". Can u Post the contents of "Message/NetworkController.h" file.....

Dinesh Kumar
You may use classdump to get the head file of that framework.
iPhoney
In "MessageUI" framework?,I cant find the Networkcontroller.h file.But in IOkit framework,I can find "IONetworkController.h" file do u mean this?
Dinesh Kumar
No, it's in Message.framework and it's a private framework. Note that you cant put your apps to the App Store if you use this header file.
iPhoney
A: 

Is there anyway to get the IMEI with OS4?

Can i call __CTGetIMEI with iOS4?

If yes how i can do this?

mabstrei