Before iOS7, it is convenient to use [[Uidevice Currentdevice] uniqueidentifier] to obtain the udid of the device, but this method is no longer applicable after iOS7.
You can use [[uidevicecurrentdevice]valueforkey:@] uniqueidentifier to get a value, but this value has become the FFFFFF+IDFV value in IOS7, and obviously, This value does not uniquely identify the device.
Another talk about the IMEI, this value seems to be missing in the 5.0 SDK, the private library message.framework MFNetworkController.h removed this method.
I think iOS7 and above system can not get these values, but look at others Cydia, not to get good? Refer to the source code of Cydia:
mobilecydia.mm
You can see that it uses the Libmobilegestalt.dylib dynamic library, and here's how to do that.
1. Import Libmobilegestalt.dylib Library
2. Declaration of Accession
[OBJC]View Plaincopyprint?
- Objc_externcfstringref mgcopyanswer (cfstringref key) Weak_import_attribute;
3, use the following methods to obtain
[OBJC]View Plaincopyprint?
- Cfstringref UDID = Mgcopyanswer (Cfstr ("Uniquedeviceid"));
- Cfstringref IMEI =mgcopyanswer (cfstr ("internationalmobileequipmentidentity"));
- Cfstringrefserialnumber = Mgcopyanswer (Cfstr ("serialnumber"));
[OBJC]View Plaincopyprint?
- Cfarrayref Iccidarray =mgcopyanswer (cfstr ("Carrierbundleinfoarray"));
- Cfdictionaryref icciddic =cfarraygetvalueatindex (iccidarray, 0);
- Cfstringref ICCID =cfdictionarygetvalue (Icciddic, Cfstr ("integratedcircuitcardidentity"));
[OBJC]View Plaincopyprint?
- cfstringrefwifiaddress = Mgcopyanswer (Cfstr ("wifiaddress"));
- cfstringrefbluetoothaddress = Mgcopyanswer (Cfstr ("bluetoothaddress"));
- Cfstringrefcpuarchitecture = Mgcopyanswer (Cfstr ("cpuarchitecture"));
- Cfstringrefproducttype = Mgcopyanswer (Cfstr ("ProductType"));
- Cftyperefairplanemode = Mgcopyanswer (Cfstr ("Airplanemode"));
- if (Airplanemode ==kcfbooleantrue) {...}
4, after testing found these methods in the iOS7 below without jailbreak can be taken, in iOS7 need to jailbreak and create Xxx.entitlements file, add the following permissions
5. Add the file you just created in buildsettings code signingentitlements xxx.entitlements
6. Compile and run
7. Attach Demo Project
http://download.csdn.net/detail/ookcode/8247495
8. My environment
Xcode 6.1
IOS 8.1 SDK
OS X 10.9.5
Get information such as device Udid, IMEI, ICCID, serial number, MAC address, etc.