Private unique device identifier in iOS

前端 未结 8 1196
不知归路
不知归路 2021-01-30 01:57

We\'re working on a project with my colleagues which involves using a lot of private and non official code. This is not intended for AppStore use.

The f

8条回答
  •  猫巷女王i
    2021-01-30 02:21

    Actually i don't know this solution is helpful or not. but after removed support of UDID. i have manage Unique device identity following way. with help of Vendor ID. Here what we did that.

    As initial while application will run, i will check out that weather vendor ID for specific app is stored in key chain or not. if it not stored then i will store that vendor ID in key chain. so second time once my app is going to check again that weather vendor ID for specific app it stored of not in key chain. if stored then bring it from key chain and doing action on same according to requirement. so here alway vendor ID is unique for device.

    Here are the steps that we keep uniqueness of device with help of vendor ID.

    Step 1 : Integrate Lockbox in your project. that will help you to stored/retrived vendor ID in/from key chain.

    Step 2 : Here are the code that perform action of checking vendor ID and retrieving vendor ID from key chain.

    -(NSString*)getidentifierForVendor{
        NSString *aStrExisting = [Lockbox stringForKey:[[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleIdentifierKey]];
    
        if (aStrExisting == Nil) {
            NSString *aVendorID = [[[UIDevice currentDevice]identifierForVendor]UUIDString];
            aStrExisting=aVendorID;
            [Lockbox setString:aVendorID forKey:[[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleIdentifierKey]];
            return aVendorID;
        }else{
            return aStrExisting;
        }
    

    With help of above steps, you always get uniqueness of device. because key chain is never deleted. it always updated.

    Hope this help you...

提交回复
热议问题