你可以使用这个(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/