Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get UDID of iOS Device Programmatically in iOS 7

i am using the below code to display the UDID of the device. But its displaying the null value

i.e. 2014-05-12 11:56:06.896 LoginScreen[195:60b] deviceUDID: (null)

NSUUID *deviceId;
deviceId = [UIDevice currentDevice].identifierForVendor;
NSLog(@"deviceUDID: %@",deviceID);

Sorry to all of you. I made a silly mistake

Here NSUUID instance is deviceId and i am printing deviceID in NSLog :)

Now it is working for me. Thanks to everyone

like image 942
Brijesh Singh Avatar asked Mar 19 '23 15:03

Brijesh Singh


2 Answers

In order to get UUID of the device you can use the following line of code

[[[UIDevice currentDevice] identifierForVendor] UUIDString];

But you have to check whether the app is running on simulator or on device.

hope this helps you.

like image 105
Shubhendu Avatar answered Mar 22 '23 05:03

Shubhendu


Apple has hidden the UDID from all public APIs, starting with iOS 7. Any UDID that begins with FFFF is a fake ID.

like image 23
Gajendra Rawat Avatar answered Mar 22 '23 05:03

Gajendra Rawat