Unique Identification of iOS Device for iOS 7.0 and Above

Unique Identification of iOS device for iOS 7.0 and above

Since iOS 7 it is no longer possible to get any unique device identifiers.

Your options are:

  • create your own unique ID and save it in the keychain.
  • use the vendor ID, which will be reset if all the app by the same vendor are removed from the device.

Getting two different device IDs from same iphone

one easiest way is to solve this issue by storing the identifierForVendor in keychain. even if you uninstall app ,value for the key remains same and its unchanged. many third party libraries available to perform this . one of them https://github.com/jrendel/SwiftKeychainWrapper.

func getGlobalUniqueIdentifierFromKeyChain()->String{

let retrievedString: String? = KeychainWrapper.standard.string(forKey: "DeviceId")

if retrievedString == nil{
if let deviceKey = UIDevice.current.identifierForVendor?.uuidString{
let _ = KeychainWrapper.standard.set(deviceKey, forKey: "DeviceId")
}
}

if let globalID = KeychainWrapper.standard.string(forKey: "DeviceId"){
return globalID
}else{
return UIDevice.current.identifierForVendor?.uuidString ?? ""
}
}

How can you uniquely identify an iOS device?

The closest thing we have to the uuid is the vendor id now

iOS7 - Device unique identifier

3) Any other suggestions...

You should consider strategies for identifying and authorizing the user instead of the device. Depending on a device-specific identifier prevents authorized users from switching devices without some sort of administrator interaction, and allows non-authorized users access if they happen to find/steal/borrow an authorized device. You can avoid these problems by relying on user credentials instead of device identifiers.

How to identify iOS device uniquely instead of using UUID and UDID

Apple has done away with the approach of UDIDs and will reject apps that use the same for unique device identification.
Source: TNW

What you are looking for is Vendor ID

How to get unique id in iOS device?

You can no longer get a unique ID per device. identifierForVendor is the best you're going to get. Apple has systematically disabled identifying a specific device so that users' IDs can't be passed around by marketers.

To get the identifier ID as a string, you can use

let deviceId = UIDevice.current.identifierForVendor?.uuidString

UPDATE

If you want a universal ID then you have the option to use advertisingIdentifier. However, if the user has limited ad tracking in their device settings then this value will simply return all zeroes.

import AdSupport

let identifierManager = ASIdentifierManager.shared()
if identifierManager.isAdvertisingTrackingEnabled {
let deviceId = identifierManager.advertisingIdentifier.uuidString
}

N.B. Apple recommends that this code only be used by companies building advertisement frameworks, rather than the app developers themselves. If you use this within your code for non-ad-related purposes then prepare to have your app rejected.

iOS 7 showing different UDIDs in different applications

You can't.

identifierForVendor will only give you the same identifier for apps from the same developer on that device. And it's not guaranteed to be permanent; if you delete all the apps from the vendor, and then reinstall them, it's likely you'll get a different identifier.

As for your iOS6 implementation, that's not going to give you anything permanent, as the point of a UUID is to give you a unique string every time.



Related Topics



Leave a reply



Submit