identifierForVendor for UUIDString returns null
Asked Answered
B

2

9

I have implemented push notification in my iPhone app and for device registration i used following code in the app.

[[[UIDevice currentDevice] identifierForVendor] UUIDString];

Above code works fine in the most of the devices. However, recently in some iPhone 5s devices with iOS 7.1 it returns null and due to this app crashes.

Bimah answered 3/4, 2014 at 22:7 Comment(2)
Did you find any solutions? I am also having the same issue.Pallmall
@iOSMonster : i didn't get exact solution but as i believe this is happen because of device name with char ' (Apostrophes).Bimah
I
1

Quoting the documentation;

If the value is nil, wait and get the value again later. This happens, for example, after the device has been restarted but before the user has unlocked the device.

This can happen for instance with a VoIP app that starts by the system on restart to allow the app to listen for incoming calls.

Islet answered 27/4, 2020 at 13:12 Comment(0)
I
-3

As this is now a old question,i also faced the same issues.So I felt to answer here for others,if they come a across this issues.

NSString *uid=[[UIDevice currentDevice] uniqueIdentifier];
NSLog(@"udd:%@",uid);
Intricate answered 17/6, 2014 at 11:40 Comment(1)
That property doesn't exist on modern iOS versions.Bruch

© 2022 - 2024 — McMap. All rights reserved.