UniqueIdentifier now causing rejections from Apple

2019-03-05 18:41发布

问题:

This question already has an answer here:

  • UIDevice uniqueIdentifier deprecated - What to do now? 32 answers

Please, do not mark this as a duplicate. This question is about Simperium and the way it deals with uniqueIdentifier and identifierForVendor.

Simperium is still using [[UIDevice currentDevice] uniqueIdentifier] in Simperium.m. This has been deprecated and Apple is now completely rejecting apps that use that call.

I am experimenting with [[[UIDevice] currentDevice] identifierForVendor] UUIDString]; but I am not sure if there would be any problem doing so.

What do you say?

Best,

回答1:

According to Apple documents identifierForVendor can be used from iOS 6.0 and later so no issues in using identifierForVendor



回答2:

It is should work. Because they say

"While you may have removed access and usage of UDIDs from your app, the invalid binary message indicates that your app uses or accesses UDIDs. Please check your source code for any occurrence of the "uniqueIdentifier" method; this is the method that returns a device's UDID."

So it is only matter of using "uniqueIdentifier" method.

Thanks



回答3:

You can also use this method for fetching uniqueidentifier for your app.

- (NSString *)createUUID{

NSString *uIdentifier = [[NSUserDefaults standardUserDefaults] objectForKey:@"Unique identifier for test"];

if (!uIdentifier) {

    CFUUIDRef uuidRef = CFUUIDCreate(NULL);

    CFStringRef uuidStringRef = CFUUIDCreateString(NULL, uuidRef);

    CFRelease(uuidRef);

    uIdentifier = [NSString stringWithString:(NSString *)CFBridgingRelease(uuidStringRef)];

    [[NSUserDefaults standardUserDefaults] setObject:uIdentifier forKey:@"Unique identifier for test"];

    [[NSUserDefaults standardUserDefaults] synchronize];

}

return uIdentifier;

}