WWDC 2013 has closed, IOS7 Beta released, the interface of the ugly no Word table ..., is simply a cottage Android.
More to the iOS program ape Sad is that the device uniquely identified MAC address in the IOS7 also failed.
In an iOS system, there are a number of ways to get a unique identity for a device:
I. UDID (Unique Device Identifier)
The full name of Udid is unique device Identifier, which, as its name implies, is the unique identifier of the Apple iOS device, which consists of 40 characters of letters and numbers.
Two. UUID (universally Unique Identifier)
UUID is universally unique identifier abbreviation, Chinese meaning is universal unique identification code.
three. MAC Address
Four. OPEN UDID
Five. advertising identifiers (Idfa-identifierforidentifier)
Six.Vindor identifiers (Idfv-identifierforvendor)
Vendor is the first two parts of cfbundleidentifier (reverse DNS format). applications from the same carrier run on the same device, the value of this property is the same, and different carrier applications run on the same device with different values.
After testing, as long as there is a Tencent app on the device, reinstall the Identifierforvendor value unchanged, if the Tencent app is all removed, reinstall the Identifierforvendor value change.
Unfortunately, all of these identifiers, which represent the unique number of the device, are either forbidden in IOS7 or are not obtained two times after reinstalling the program.
Since the data stored in the iOS system is in the sandbox, the deletion of App,sandbox is no longer present. Fortunately there is an exception, that is keychain (keychain).
Typically, iOS systems use Nsuserdefaults to store data, but for some private information, such as passwords, certificates, and so on, you need to use a more secure keychain.
The information stored in the keychain is not lost due to the app being deleted. Therefore, this keychain feature can be used to preserve the unique identity of the device.
So, how to use keychain in the application, we need to import security.framework, Keychain operation Interface declaration in the header file SecItem.h.
Directly using the SecItem.h method to operate the keychain, the code needs to write more complex, we can use the already encapsulated tool class Keychainitemwrapper to operate on keychain.
Keychainitemwrapper is the Apple official example "Generickeychain" in a keychain common operation of the package class, after downloading the Generickeychain project on the official website,
Just copy the "KeychainItemWrapper.h" and "KEYCHAINITEMWRAPPER.M" to our project and import the Security.framework. Usage of Keychainitemwrapper:
/** Initializes a keychainitemwrapper to save the user account * /Keychainitemwrapper*Wrapper=[[Keychainitemwrapper Alloc]Initwithidentifier:@" account Number"Accessgroup:@"YOUR_APP_ID_HERE.com.yourcompany.AppIdentifier"];//Save Data[Wrapper SetObject:@"< account >"Forkey:(Id)Ksecattraccount]; [Wrapper SetObject:@"< account password >"Forkey:(Id)Ksecvaluedata];//Remove account password from keychainNSString*Password=[Wrapper Objectforkey:(Id)Ksecvaluedata];//Clear Settings[Wrapper Resetkeychainitem];
Where method "-(void) SetObject: (ID) inobject Forkey: (ID) key;" The value of the parameter "Forkey" should be the key that is defined in the file "SecItem.h" in Security.framework, and the key program with other strings will be wrong!
Source: http://blog.csdn.net/zhao19861029/article/details/754229
Other than that:
Poke Generickeychain to the Apple website to download examples and keychainitemwrapper source files.
Keychainitemwrapper *keychain=[[keychainitemwrapper alloc] Initwithidentifier:@ "xxxxxx" accessgroup:Nil ];//xxxx Custom
Save
[keywrapper setobject:@ "mychainvalues" forkey :( ID )ksecattrservice];
[ KeyWrapp Er&NBSP; setobject :[ usernametextfield< Span class= "S1" >&NBSP; text ]&NBSP; forkey :( id ) Ksecattraccount ];//above two lines to identify an item
[keywrapper setobject: [passwordtextfield text] Forkey :( ID )ksecvaluedata];
Read
[ username Textfield&NBSP; settext :[ keywrapper< Span class= "S1" >&NBSP;&NBSP; objectforkey :( id ksecattraccount ];
[ passwordtextfield &NBSP; settext keywrapper &NBSP; objectforkey :( id ksecvaluedata
[Go] iOS7 How to obtain a Device unique identity