How to get device phone number or unique id in Swift?
Anyway, how can I figure out my phone number using Swift? This is because I want to get the unique iOS device number ID for my app. In android we can get the device SID and its ID never changes when the app is uninstalled and installed again. For Swift, how can I get a unique id or phone number?
a unique android id as well as an example of a secure id
String deviceId = Secure.getString(this.getContentResolver(),
Secure.ANDROID_ID);
iOS Swift
var uuid = NSUUID().UUIDString
Above the line, will uuide be changed after re-installing the app?
Apple was forced to remove access to the device UUID after a large secret keypf appeared on the media.
There is now a call to UIDevice identifierForVendor
that comes close to you. This is an identifier that is unique to the current device from your application.
Here is a code snippet
let dID = CFUUIDCreate(kCFAllocatorDefault)
let deviceID = CFUUIDCreateString(kCFAllocatorDefault, deviceID) as NSString