获取iOS 8上的设备序列号

对于内部应用程序,我们使用以下代码UIDevice + serialNumber来获取设备序列号。 但是,似乎在iOS 8中,注册表项“IOPlatformSerialNumber”为空。 序列号可以通过其他方式获得吗?

答:没有。

目前有滥用.mobileconfig的浮动解决方案,但由于它们的性质,它们会增加其他问题。

出于某种原因删除了UUID。 从2011年开始,查看美国Senat关于隐私和Apple召唤的消息,以了解为何必须更改。 http://arstechnica.com/apple/2011/04/apple-google-asked-to-join-judiciary-hearing-on-mobile-device-privacy/

滥用底层march端口以获取设备序列号作为UUID的替换不是解决方案。 现在同样滥用移动配置并猜测它将工作多长时间。

您有很多不错的方法来处理之前使用过设备识别的任何情况。 特别是在您拥有加密和MDM的企业环境中,绝对没有必要跟踪这样的设备。

在iOS中不再可以直接检索设备序列号。

但是,如果它只是一个内部企业应用程序,我工作的公司要实现的是:

在设备配置期间,复制序列号并将设备名称设置为序列号。

然后使用Apple的UIDevice API检索设备名称。

正如Helger所述,出于安全/隐私原因,iOS 6+中不再提供UDID。 相反,使用identifierForVendoradvertisingIdentifier请检查UDID替换API

适用于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; } } 

您可以使用identifierForVendor将它们存储到钥匙串并稍后使用。 因为重新安装应用程序时钥匙串的价值不会改变。

我过去常常使用Open UDID 。 不知道它是否仍然有效。

Apple设备的序列号可在设置 – >常规 – >关于 – >序列号下找到。