Do you want your application can identify a device permanently even if users delete and reinstall the app? Follow this article and you will get there.
This post help you detect a iphone permanently, ios detect device
1) You need to using UICKeyChainStore: Download here
This post help you detect a iphone permanently, ios detect device
1) You need to using UICKeyChainStore: Download here
2) Import this lib in your project.
3) Create a function
- (NSString *)getDeviceId
{
NSString *deviceIdLoad = [UICKeyChainStore stringForKey:@"deviceId" service:@"Devices"];
if(deviceIdLoad == nil)
{
/* Unique Device */
NSString *deviceIdGet = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
[UICKeyChainStore setString:deviceIdGet forKey:@"deviceId" service:@"Devices"];
deviceIdLoad = [UICKeyChainStore stringForKey:@"deviceId" service:@"Devices"];
}
if(deviceIdLoad == nil)
{
[self showMessage:@"Error can't get indentify"];
}
return deviceIdLoad;
}
4) Call this function to get device ID
NSString *deviceIdLoad = [self getDeviceId];
5) Save device id in online database
You get iphone id with this lib and save this id into online device for using in future, this id never change and you can control your app to know id register or not.
Hope this help someone.
Happy coding.
Comments
Post a Comment