ForVendor ID for UUIDString returns null

I implemented push notification in my application for iPhone and I used the following code in the application to register the device.

[[[UIDevice currentDevice] identifierForVendor] UUIDString]; 

The code works fine on most devices. Recently, however, on some iPhone 5s devices with iOS 7.1, it returns null, and because of this, application crashes.

+7
ios7 push-notification iphone-5 apple-push-notifications
source share
2 answers

According to Apple documentation

If the value is nil, wait and get the value again later. This happens, for example, after restarting the device, but before the user unlocks the device

you can read here: UIDevice

We encountered the same thing in our application that we ended up using

 [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString] 

here is his link: ASIdentifierManager

From experience, the identifier remains unchanged when reinstalling on the same device. I did not find the template when it changes, but it ... is the same as the identifier ForVendor.

+4
source share

Since this is an old question, I also ran into the same problems. So I decided to answer others here if they ran into these problems.

 NSString *uid=[[UIDevice currentDevice] uniqueIdentifier]; NSLog(@"udd:%@",uid); 
0
source share

All Articles