Solution to get device unique logo on "reprint" iOS

Source: Internet
Author: User

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
  1. -(void) Setkeychainvalue
  2. {
  3. Keychainitemwrapper *keychainitem=[[keychainitemwrapper alloc]initwithidentifier:@"TestUUID" accessGroup:@  "Xxxxxx.h.helloworld"];
  4. NSString *struuid = [Keychainitem objectforkey: (ID) ksecvaluedata];
  5. if (struuid==nil| | [Struuid isequaltostring:@""])
  6. {
  7. [Keychainitem setobject:[self Gen_uuid] Forkey: (ID) ksecvaluedata];
  8. }
  9. [Keychainitem release];
  10. }
  11. -(NSString *) gen_uuid
  12. {
  13. Cfuuidref uuid_ref=cfuuidcreate (nil);
  14. Cfstringref uuid_string_ref=cfuuidcreatestring (nil, uuid_ref);
  15. Cfrelease (UUID_REF);
  16. NSString *uuid=[nsstring Stringwithstring:uuid_string_ref];
  17. Cfrelease (UUID_STRING_REF);
  18. return UUID;
  19. }

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
    • View Picture Attachments

Solution to get device unique logo on "reprint" iOS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.