Original address: http://lqzit.iteye.com/blog/2070306
Note: After the Keychina is set up, the "project name. Entitlements" file in the project directory is not created manually, but it is done by clicking on the capabilities in the project root------>keychain After the sharing is set up, a folder that automatically appears in the Proj.ios directory with a project name is the "project name. Entitlements" file.
==================
Apple once again ruthlessly banned MAC addresses in IOS 7, and is now unable to get the physical address of the IOS7 device. So how can you identify the uniqueness of a device in development? Apple's approach is to store some flag information through keychain and then use the stored flag information to let the application identify the uniqueness of the device.
The Apple company has written a simple Keychain tool class: https://developer.apple.com/library/ios/samplecode/GenericKeychain/Listings/ Classes_keychainitemwrapper_m.html can be downloaded, the keychainitemwrapper.h,.m file is referenced in Xcode, KEYCHAINITEMWRAPPER.M file may be wrong, this is due to the arc compilation, we can follow the prompts to solve, can also be resolved as follows:
Then set the keychain share:
This allows us to see the xxxxx.entitlements end of the file in the project. <?xml version= "1.0" encoding= "UTF-8"?>
<! DOCTYPE plist Public "-//apple//dtd plist 1.0//en" "Http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
<plist version= "1.0" >
<string>$ (Appidentifierprefix) h.helloworld</string>
</plist>
The ${appldentifierprefix} is a prefix for the developer account and is provided by Apple's company, Https://developer.apple.com/membercenter/index.action, and can be viewed in its own account.
Access: Key chain:
Java code
- -(void) Setkeychainvalue
- {
- Keychainitemwrapper *keychainitem=[[keychainitemwrapper alloc]initwithidentifier:@"TestUUID" accessGroup:@ "Xxxxxx.h.helloworld"];
- NSString *struuid = [Keychainitem objectforkey: (ID) ksecvaluedata];
- if (struuid==nil| | [Struuid isequaltostring:@""])
- {
- [Keychainitem setobject:[self Gen_uuid] Forkey: (ID) ksecvaluedata];
- }
- [Keychainitem release];
- }
- -(NSString *) gen_uuid
- {
- Cfuuidref uuid_ref=cfuuidcreate (nil);
- Cfstringref uuid_string_ref=cfuuidcreatestring (nil, uuid_ref);
- Cfrelease (UUID_REF);
- NSString *uuid=[nsstring Stringwithstring:uuid_string_ref];
- Cfrelease (UUID_STRING_REF);
- return UUID;
- }
The first time an application runs on a device, our application saves a UUID to identify the device. When the device removes the program, the UUID still exists in the device.
- Keychainitemwrap.zip (6.5 KB)
- Download number of times: 36
Solution to get device unique logo on "reprint" iOS