6

I have iOS 7 jail-broken iPhone and I want to access about info (e.g settings -> General -> About). Actually I want to get IMEI and other stuff in about controller. Any clue guide will highly appreciated.

Ahad Khan
  • 411
  • 2
  • 18

1 Answers1

3

MobileGestalt Library has a lot of information check it's header here

add this in your MakeFile

xxx_LIBRARIES = MobileGestalt

then declare:

OBJC_EXTERN CFStringRef MGCopyAnswer(CFStringRef key) WEAK_IMPORT_ATTRIBUTE;

in your Header file

then for getting the IMEI number you have to use :

CFStringRef IMEINumber = MGCopyAnswer(CFSTR("InternationalMobileEquipmentIdentity"));
NSLog (@"IMEI Number : %@", IMEINumber);

GoodLuck..

iMokhles
  • 219
  • 2
  • 9
  • I have added header in my project when I compile code give me error that is Undefined symbols for architecture armv7: "_MGCopyAnswer", referenced from: . I m working on iOS 7 and Xcode 5.0 – Ahad Khan Apr 11 '14 at 08:45
  • did you add xxx_LIBRARIES = MobileGestalt to your makefile ? [ xxx ] is your tweak name ;) – iMokhles Apr 11 '14 at 08:46
  • Could you please explain what do you means by "xxx_LIBRARIES = MobileGestalt". – Ahad Khan Apr 11 '14 at 08:52
  • if you are using theos you should get MakeFile with the created project open it and add YOURTWEAKNAME_LIBRARIES = MobileGestalt – iMokhles Apr 11 '14 at 08:58
  • I m not using theos. i have modified Xcode settings. Is there any alternative to resolve this error " Undefined symbols for architecture armv7: "_MGCopyAnswer", referenced from" – Ahad Khan Apr 11 '14 at 09:15
  • yes, there are go to Target ~> Build Phases ~> Link Binary With Libraries then Add libMobileGestalt.dylib GoodLuck ;) – iMokhles Apr 11 '14 at 09:53
  • libMobileGestalt.dylib make project error free but do not return IMEI. It returns NULL – Ahad Khan Apr 11 '14 at 10:09
  • yes because you are using a private header ;) you have to use it with mobile substrate ;) and it's your tour now .. – iMokhles Apr 11 '14 at 10:10
  • one more thing it won't work in simulator ;) just on jailbroken iDevices – iMokhles Apr 11 '14 at 10:17
  • Yes i am testing on jailbroken device. you said " have to use it with mobile substrate" what does this mean. – Ahad Khan Apr 11 '14 at 10:23
  • libMobileGestalt.dylib make project error " <~ can you show me this error ? – iMokhles Apr 11 '14 at 10:27
  • It gives compile time error which is "Undefined symbols for architecture armv7: "_MGCopyAnswer"" – Ahad Khan Apr 11 '14 at 10:37
  • mmmmm. did you add OBJC_EXTERN CFStringRef MGCopyAnswer(CFStringRef key) WEAK_IMPORT_ATTRIBUTE; in your header after '@end' – iMokhles Apr 11 '14 at 10:38
  • and here is a code for cydia tweak, [Here](https://ghostbin.com/paste/qpax4) which get your IMEI when you put your device in charge... – iMokhles Apr 11 '14 at 10:43
  • I m using xcode 5.0. As I import header file and run the it give me run time error (means do not compile). error comes in MobileGestalt.h line "CFPropertyListRef MGCopyAnswer(CFStringRef property); it says CONFILICTING TYPES FOR MGCopyAnswer " – Ahad Khan Apr 11 '14 at 10:51
  • OOOOOH SH*** LOL you have to remove MobileGestalt.h from your project it only for getting information.. and keep OBJC_EXTERN CFStringRef MGCopyAnswer(CFStringRef key) WEAK_IMPORT_ATTRIBUTE; – iMokhles Apr 11 '14 at 10:56
  • and you just use MobileGestalt.h for knowing information names and use it like imei just you have to change "InternationalMobileEquipmentIdentity" with any other information.. – iMokhles Apr 11 '14 at 10:58
  • Is it possible that i access IMEI from its core location. I mean I just read plist or something like that where IMEI is stored. – Ahad Khan Apr 11 '14 at 10:58
  • thanks for your support. it works for other stuff like model unique id. but IMEI is still null.. why is this so – Ahad Khan Apr 11 '14 at 11:15
  • you are welcome... but, bad question, do you test it on an iPad Wifi or iPod Touch :S LOL... – iMokhles Apr 11 '14 at 11:18
  • There are several ways to retrieve IMEI http://stackoverflow.com/questions/16667988/how-to-get-imei-on-iphone-5 But on iOS 7 they all require you to sign your app with `com.apple.coretelephony.Identity.get` entitlement. – creker Apr 11 '14 at 18:38
  • @creker could please tell me that how should sign my app with com.apple.coretelephony.Identity.get entitlement. I m using Xcode 5.0.2 and iOS 7. – Ahad Khan Apr 15 '14 at 06:55
  • http://stackoverflow.com/questions/14871748/how-do-i-change-my-applications-entitlements-to-com-apple-backboard-client – creker Apr 15 '14 at 07:12