Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check user's device in iOS SDK

Tags:

ios

I am trying to fix Sim Swap issue in my app. I want a unique way to identify user's phone. So tried for following cases

  • I know that we can't get phone IMEI & other information from user device as per below links

Link1 Link2

  • I can use identifierForVendor but it also changes on every installation of the app.

  • The third option is to use DeviceCheck API to identify the device but it comes in only iOS 11.

Please let me know how to identify a users device & temporary disabled user's account in case of Sim Swap.

like image 286
Gagan_iOS Avatar asked Jan 26 '23 21:01

Gagan_iOS


1 Answers

You will have to keep UUID into keychain since keychain data persist after uninstallation of the app

iOS manages keychain information as sensitive information. you can use SwiftKeychainWrapper library to easily access your keychain.

what apple doc says on SIM change: https://developer.apple.com/documentation/coretelephony/cttelephonynetworkinfo

CodingExample:

let uuid = UIDevice.current.identifierForVendor?.uuidString
KeychainWrapper.standard.set(uuid, forKey: "appUUID")

And whenever you want to get appUUID just fetch from keychain:

let uuid = KeychainWrapper.standard.string(forKey: "appUUID")

Note: You can also check if your UUID is changed after reinstallation of the app and update it into a keychain.

like image 183
Jarvis The Avenger Avatar answered Feb 08 '23 07:02

Jarvis The Avenger