Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

identifierForVendor for UUIDString returns null

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.

like image 259
Mehul Solanki Avatar asked Apr 03 '14 22:04

Mehul Solanki


People also ask

What is identifierForVendor?

An alphanumeric string that uniquely identifies a device to the app's vendor.

Is identifierForVendor unique?

The identifierForVendor is an unique identifier that stays the same for every app of a single vendor on a single device, unless all of the vendor's apps are deleted from this device. See Apple's documentation about when this UUID changes.

How do I get IDFV on my Iphone?

Delete all apps from the vendor then reinstall an app from the same vendor and a new "IDFV" will be generated. And the same app on two different devices will give two different "IDFV" values.


1 Answers

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.

like image 85
cnotethegr8 Avatar answered Oct 21 '22 14:10

cnotethegr8