我想唯一地识别每一台设备。我可以使用use UDID吗?如何唯一识别设备?而不是iPhone的UDID。我想永久地识别和验证用户的设备,这样他就不需要在同一设备上一次又一次地验证。如何唯一识别用户的设备?
发布于 2016-03-17 19:00:59
这将始终是唯一的
+(NSString *)getDeviceId
{
UIDevice *device = [UIDevice currentDevice];
NSString *currentDeviceId = [[device identifierForVendor]UUIDString];
return currentDeviceId;
}发布于 2016-03-17 19:00:55
更好的选择是使用UDID。除了UDID之外,您还可以注册远程通知并获取设备记录。设备tocken也是独一无二的。
// swift中的UDID
let currentdeviceid = UIDevice.currentDevice().identifierForVendor?.UUIDString//设备在swift中
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
let characterSet: NSCharacterSet = NSCharacterSet( charactersInString: "<>" )
let deviceTokenString: String = ( deviceToken.description as NSString )
.stringByTrimmingCharactersInSet( characterSet )
.stringByReplacingOccurrencesOfString( " ", withString: "" ) as String
}https://stackoverflow.com/questions/36058532
复制相似问题