9

For an in-house application, we were using the following code UIDevice+serialNumber to get the device serial number. However, it seems that with iOS 8, the registry key "IOPlatformSerialNumber" is empty. Can the serial number be obtained any other way?

quentinadam
  • 3,058
  • 2
  • 27
  • 42
  • You mean, You want device Id/UDID.? Right.? – Er.Shreyansh Shah Sep 19 '14 at 04:33
  • you can create a unique random id to identify the device, it will not change unless and until you reset the device. If you want to implement this i can provide the code. – souvickcse Sep 19 '14 at 06:33
  • 4
    I want the actual serial number. This is not for an app store app, it is for an in-house app. We need the serial code and not an UUID, as this is to link back with the serial code used for managing the app through mobile device management. – quentinadam Sep 19 '14 at 08:21
  • 2
    Unfortunately not. I had to change the way the app worked as to not rely on the serial number anymore. – quentinadam Oct 15 '14 at 22:22
  • Apple has removed access to the serial number as of iOS8. You can use a vendor identifier number as an alternate solution. – A Salcedo Dec 08 '14 at 15:16

4 Answers4

2

Answer: No.

There are currently floating solutions around abusing the .mobileconfig, but they add other problems due their nature.

UUID was removed for a reason. See the news around privacy and the summon of Apple by the US Senat from 2011 to gain an understanding why this had to be changed. http://arstechnica.com/apple/2011/04/apple-google-asked-to-join-judiciary-hearing-on-mobile-device-privacy/

Abusing the underlying march port to get the device serial number as replacement of the UUID is not the solution. Same now for abusing the mobile config and guess how long that will work.

You have plenty of decent ways to handle any situation where you used device identification before. Especial in an enterprise environment where you have cryptography and MDM is absolutely no point to track a device like this.

Helge Becker
  • 3,219
  • 1
  • 20
  • 33
  • @HelgeBecker I was wondering, if my app uses .mobileconfig solution would it be accepted on the app store ? Have you tried to publish an app using the .mobileconfig to get UDID ? – Moumou Dec 02 '15 at 10:58
  • No. We use different solutions for the App-Store ti identify a device or an concrete apple id. In our Inhouse apps we do currently use the device identifier for vendor for health monitoring of all apps. Enough info to see if a problem is tied to one or several user without the need to identify them concrete. But that would be also possible. – Helge Becker Dec 03 '15 at 11:22
1

Retrieving the device serial number directly is no longer possible in iOS.

However, if it's simply for an internal enterprise app, something the company I work for is going to implement is this:

During device configuration, copy the serial number and set the device name as the serial number.

Then use Apple's UIDevice API to retrieve the device name.

RebelOfBabylon
  • 658
  • 5
  • 12
0

As Helger stated above, UDID is no longer available in iOS 6+ due to security / privacy reasons. Instead, use identifierForVendor or advertisingIdentifier Please check UDID Replacement APIs

For iOS 8+

+ (NSString *)deviceUUID
{
if([[NSUserDefaults standardUserDefaults] objectForKey:[[NSBundle mainBundle] bundleIdentifier]])
    return [[NSUserDefaults standardUserDefaults] objectForKey:[[NSBundle mainBundle] bundleIdentifier]];

@autoreleasepool {

    CFUUIDRef uuidReference = CFUUIDCreate(nil);
    CFStringRef stringReference = CFUUIDCreateString(nil, uuidReference);
    NSString *uuidString = (__bridge NSString *)(stringReference);
    [[NSUserDefaults standardUserDefaults] setObject:uuidString forKey:[[NSBundle mainBundle] bundleIdentifier]];
    [[NSUserDefaults standardUserDefaults] synchronize];
    CFRelease(uuidReference);
    CFRelease(stringReference);
    return uuidString;
 }
}

You can use identifierForVendor after that store them to keychain and use later. Because value of keychain will not changed when re-install app.

I used to use Open UDID for this purpose. Don't know if it still works.

iAhmed
  • 6,556
  • 2
  • 25
  • 31
  • I know about UUID, thanks. However, my question was specifically about how to get the serial number (not UDID nor UUID). I would be fine for a solution using the private APIs as this app is distributed through Enterprise licence. – quentinadam Oct 02 '15 at 11:06
  • As of iOS 8 , the IOPlatformSerialNumber property was removed and the call to retrieve its value now returns nil. Sorry if i misunderstood. – iAhmed Oct 02 '15 at 12:01
  • The easiest way to get a uuid in ObjC is: `[[NSUUID UUID] UUIDString]`. Also there is no purpose using `@autoreleasepool` nor `synchronize`. Factoring out into variables `[NSUserDefaults standardUserDefaults]` and `[[NSBundle mainBundle] bundleIdentifier]` would simplify the code and reduce the possibilities of typo style errors. For code safety the best practice is to always use braces "`{}`" with all `if` statements. – zaph Oct 02 '15 at 13:42
-10

The serial number for Apple devices can be found under Settings -> General -> About -> Serial number.

Neha Gupta
  • 157
  • 4