Swift 4.1 的更新,您需要使用:UIDevice.current.identifierForVendor?.uuidStringHow can I get a device's unique ID in Swift?I need an ID to use in the database and as the API-key for my web service in my social app. Something to keep track of this devices daily use and limit its queries to the database. 解决方案 You can use this (Swift 3):UIDevice.current.identifierForVendor!.uuidStringFor older versions:UIDevice.currentDevice().identifierForVendoror if you want a string:UIDevice.currentDevice().identifierForVendor!.UUIDStringThere is no longer a way to uniquely identify a device after the user uninstalled the app(s). The documentation says:You may also want to read this article by Mattt Thompson for more details:http://nshipster.com/uuid-udid-unique-identifier/Update for Swift 4.1, you will need to use:UIDevice.current.identifierForVendor?.uuidString 这篇关于如何在 Swift 中获取唯一的设备 ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-24 21:33