2

Is there a way to identify a device even after having uninstalled an app and reinstalling again? I found topics where it's possible to get a UUID but it seems that after uninstalling the app the value of the UUID changes

The value in this property remains the same while the app (or another app from the same vendor) is installed on the iOS device. The value changes when the user deletes all of that vendor’s apps from the device and subsequently reinstalls one or more of them.

I installed an App called Jodel, you don't have to create an Account to use the app and After uninstalling it, delete iCloud data, logging out from iCloud... an reinstalling it I was still logged in in the App. I assume they use a unique device identifier? Do you have an idea how such mechanism could be implemented?

jscs
  • 63,694
  • 13
  • 151
  • 195
j.doe
  • 4,559
  • 6
  • 20
  • 31

2 Answers2

1

You can use Keychain Service to store data still after uninstalling app from device.

for more reference about keychain service check this

https://developer.apple.com/documentation/security/keychain_services

Jaydeep Vora
  • 6,085
  • 1
  • 22
  • 40
1

Yes, It's Possible

#import "UICKeyChainStore.h"

AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{
    [self getDeviceIdFromKeychain];
}

- (void)getDeviceIdFromKeychain 
{
    NSString *deviceID = [UICKeyChainStore stringForKey:@"KEY TO SAVE TO Keychain" service:nil];

    // if vandorid from keychain is not nil
    if (deviceID)
    {
        [[NSUserDefaults standardUserDefaults] setObject:deviceID forKey:@"deviceID"];
        [[NSUserDefaults standardUserDefaults] synchronize];
    }
    // else it goes for new vendorid and then stored it to keychan
    else if (deviceID == (id)[NSNull null] || deviceID.length == 0 )
    {
        deviceID = [[[UIDevice currentDevice] identifierForVendor] UUIDString];

        [UICKeyChainStore setString:deviceID forKey:@"KEY TO SAVE TO Keychain"  service:nil];

        [[NSUserDefaults standardUserDefaults] setObject:deviceID forKey:@"deviceID"];
        [[NSUserDefaults standardUserDefaults] synchronize];
        // NSLog(@"VendorID Local - %@",deviceID);
    }
}

ViewContoller.m

- (void)viewDidLoad 
{
    NSString *strDeviceId = [[NSUserDefaults standardUserDefaults]objectForKey:@"deviceID"];
}
mugx
  • 9,869
  • 3
  • 43
  • 55
kalpesh satasiya
  • 799
  • 8
  • 18