How to get unique id in iOS device?

后端 未结 6 1062
隐瞒了意图╮
隐瞒了意图╮ 2020-11-27 02:42

I have used mac address to identify iOS devices in server side. When run my application with iOS 7 unable to retrieve the correct mac address. Alternately i used

         


        
6条回答
  •  猫巷女王i
    2020-11-27 03:16

    The best way to get the device id is identifierForVendor

    UIDevice *device = [UIDevice currentDevice];
    
    NSString  *currentDeviceId = [[device identifierForVendor]UUIDString];
    

    UPDATE

    For Swift 4.1 use

    UIDevice.current.identifierForVendor?.uuidString
    

提交回复
热议问题