Transferred from: http://supershll.blog.163.com/blog/static/37070436201399111929848/
1, Keychain Method: Http://www.cnblogs.com/smileEvday/p/UDID.html Project Geology: Https://github.com/smileEvday/SvUDID Use the Svudidtools in your project. Now excerpt from the following:
Apple provides a way to allow multiple apps from the same sender to access each app, specifying Accessgroup, which is the Access group, when Secitemadd adds data. An app can belong to a colleague belonging to multiple groupings, and adding a Keychain data access group requires two things:
A, set the COde Signing entitlements inside the app Target's bulibsetting, and point to the plist file that contains the grouping information for the Aceessgroup. The file must be in the same directory as the project file, I add access to the group because of the Plist file location problem, operation Keychain failure, it took a long time to find the problem.
b, create a new Keychainaccessgroups.plist file in the project directory, the topmost node in the structure of the file must be an array named "Keychain-access-groups", And each item in the array is a nsstring that describes the grouping.
"YourAppID.com.yourCompany.whatever" is the name of the public area you want to play, in addition to the whatever field can be arbitrarily set aside, the others must be truthfully filled out. The path of this file is to be configuredin Project->build Setting->co de Signing entitlements, otherwise the public area is invalid, after the configuration, it must be compiled with your official certificate signature to pass, Otherwise Xcode will frame to tell you thatthe Co de signing has a problem. So, Apple restricts you to share keychain data with your company's products, and other companies won't be able to access your company's products keychain.
Yourappid from here:
The first 10 characters of the fifth column are the app Identifier
Query and add or update see Https://github.com/smileEvday/SvUDID using the SVUDIDTOOLS.M file in your project.
Start by creating a dictionary that sets the lookup criteria and then gets the data that we saved to keychain by using the Secitemcopymatching method.
Finally, there is a small place that is easily overlooked. Well configuredCOde Signing Entitlements, it is not possible to compile with team certificate, but this can cause a lot of problems in the development of iteration of the normal version. In fact, look closely at Code Signing entitlements, you can find that debug and release can be configured separately. Debug mode does not configure the path, it solves the problem.
2. Identifierforvendor: A new value is generated when the program is unloaded.
3. Get IMEI:
1) https://github.com/erica/uidevice-extension/blob/master/UIDevice-IOKitExtensions.m
Introduction to//iokit import: http://ios-blog.co.uk/tutorials/iokit-an-introduction/
2), Networkcontroller way:
nsstring* Sdk_path = @/developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator${iphone_ Sdk}.sdk/system/library/privateframeworks; Path modification as appropriate
nsbundle *b = [NSBundle bundlewithpath:[nsstring stringwithformat:@%@/message.framework, Sdk_path]];
if ([b load]) {
Class Networkcontroller = nsclassfromstring (@ networkcontroller);
id NC = [networkcontroller sharedinstance];
NSLog (@--IMEI:%@, [NC IMEI]);
}
//Tested: Failed
3), Coretelephony way: https://github.com/search?l=Objective-C&q=imei&ref=simplesearch&type= Repositories seems to be only a jailbreak version.
iOS7 temporarily replaces the MAC address as a uniquely identifiable method!