
我需要一个ID在数据库中使用,并作为我的社交应用程序中的Web服务的API密钥。跟踪此设备的日常使用,并限制其查询到数据库。
谢谢!
你可以使用这个(Swift 3):UIDevice.current.IDentifIErForvendor!.uuIDString
对于较旧版本:
UIDevice.currentDevice().IDentifIErForvendor
或者如果你想要一个字符串:
UIDevice.currentDevice().IDentifIErForvendor!.UUIDString
在用户卸载应用程序后,不再有唯一标识设备的方法。文档说:
The value in this property remains the same while the app (or another app from the same vendor) is installed on the iOS device. The value changes when the user deletes all of that vendor’s apps from the device and subsequently reinstalls one or more of them.
您也可以阅读Mattt Thompson的这篇文章,了解更多详情:
http://nshipster.com/uuid-udid-unique-identifier/
以上是内存溢出为你收集整理的如何在Swift中获取唯一的设备ID?全部内容,希望文章能够帮你解决如何在Swift中获取唯一的设备ID?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)