简体   繁体   中英

How to design choose the SIM and get a unique id in iOS while authentication?

A) In android i can get the SIM details and can specifically choose the SIM for sending the OTP from that SIM. I have a sample screen which is possible to implement in Android.

I followed the link for ios How can I get details about the device data provider (like Verizon/AT&T) of an iphone programmatically?

https://developer.apple.com/forums/thread/9171 This link states we cant get the SIM Phone numbers from device because of Apple Privacy policy

How to implement the same screen in iOS? Any alternative idea or help is appreciated

B) How to get the Unique id for authentication?

In Android we can get (IMEI+SIM Serial number) can be used for authentication but in iOS all these are restricted due to privacy. Instead it is impossible to get UDID which is unique for every device. I know i can use vendor id for this:

UIDevice.current.identifierForVendor!.uuidString

But as the documentation says: The value in this property remains the same while the app (or another app from the same vendor) is installed on the iOS device. The value changes when the user deletes all of that vendor's apps from the device and subsequently reinstalls one or more of them. The value in this property remains the same while the app (or another app from the same vendor) is installed on the iOS device. The value changes when the user deletes all of that vendor's apps from the device and subsequently reinstalls one or more of them.

Since the vendor id changes when the user uninstalls the Application.So is it any way around to get a unique id other than Vendor ID for authentication which doesn't change and is unique all time?

How to get SIM phone number?

As it stated in the question, its not available to get the phone number due to the security reasons. I suggest you to have a textfield and let user to enter the numbers, so you can send the sms to verify it

How to get the Unique id for authentication?

You have two options here based on your deployment target needs:

  1. Apple has come up with the DeviceCheck framework in iOS 11. Your app should use the DeviceCheck APIs to generate an ephemeral token that identifies a device. Your associated server combines this token with an authentication key that you receive from Apple and uses the result to request access to the per-device bits. Very intentionally by Apple, DeviceCheck tokens can not be used to identify the specific device. But you can try playing to get unique identifier for the iOS device state

  2. Create your own unique ID and save it in the keychain .

References

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM