Skip to main content

xcode ios Device Unique ID permanently, ios detect device

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
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

Popular posts from this blog

IOS Storyboard presentViewController custom style

IOS Storyboard presentViewController custom style I will try to harwork for swich viewcontroller with custom style with out navigationbar, to do this, can using this code.