iOS device specific unique identifier - ios

Is there any way to generate unique id for IOS devices?
I have a framework that helps to the apps to take login token from it, I am using identifierForVendor with no problems because all consumer apps published from same vendor, but I want to add another one from different publisher and adding that app to chain, identifierForVendor is no work anymore,
Also I can't use keychain since they are using different team id,
So can you please let me know if there is any other way to do this?

If I'm not mistaken Apple has revoked access to the real device identifier (UDID) and rather provides a pseudo-identifier to limit malicious usage thereof.
Refer to this previous answer https://stackoverflow.com/a/19402414/28305.

UDID is not available anymore so you can use
UIDevice.currentDevice().identifierForVendor?.UUIDString
more here
Or you can use DeviceCheck framework that is available from iOS 11
Just create a new key in Apple Developer account and generate a token with
DCDevice.current.generateToken(completionHandler:)
Note: You must use only real device to receive token.
You can find good tutorial here

Short answer: no because of data privacy concerns (at least in the official statements).
Apple blocked access to 'identifiers' such as UDIDs and hardware data such as MAC addresses and others. Even if there is currently such as field, as soon as it's exploited by a certain amount of people it will be removed or obfuscated soon.
The only thing that might work for a while is trying to get a browser fingerprint of the current device.

Related

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.
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:
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
Create your own unique ID and save it in the keychain.
References
WWDC 2017 — Session 702 — iOS, macOS, tvOS, watchOS
Apple Documentation: — Access per-device, per-developer data that your associated server can use in its business logic.
Unique Identifier for the iOS Devices Article

Is there a way to get unique ID from ios device to use it for authorization into API? - React Native

I want to get some unique identifier to allow specific devices to accessing my API, but looking on internet there's no way to get it and it's against Apple Policy,
But I need to get one of unique ID (e.g IMEI, UDID, ICCID, MEID, ETC)
looking on react-native-device-info, it just have getUniqueID() that can changed
This is IDFV on iOS so it will change if all apps from the current apps vendor have been previously uninstalled.
How can I get a unique ID ios devices?
FYI: My app won't be release into AppStore
There are major privacy concerns when getting a unique ID from a device. You have a few options.
First, you could just add some form of authentication or login system. This could be per device, per user, or even 1 login for the entire API. You could also limit the API to only respond to certain controlled IP addresses.
Second, you could add a flag and have a different version for production then in development. Limiting access that way.
Third, on first launch of your app you could request a new token from your server. The device would then store that token and the server would as well (to ensure no duplicates). Then just take that stored token and send it to the server for every request.
But on the device level there are privacy concerns in unique IDs for each device. You have to build your own system to handle it depending on your needs.
I would suggest that the IDFV was designed to suit your needs, while maintaining some level of privacy.
It is supposed to allow you (a vendor) to identify a return visit while not allowing you (a vendor) to share a user's identity with a third party in a relatable way for the third party to data-mine.
If users are routinely uninstalling and re-installing all of your apps I would look at solving the distribution issue you have there. I would assume (although haven't tested) that an update of an existing app would maintain the IDFV.

How to identify iOS device across multiple apps?

As you have understood from the question's title, I would like to know, how to identify iOS device across multiple apps. Advertising identifier and identifier for vendor is not an option for me, as apps may not have AdSupport framework included, and they may not have similar vendors. MAC address of the device is also deprecated. Any working solution on this? Thanks in advance!
This functionality is explicitly disallowed by Apple. Any workaround you come up with will violate Apple's stated goal of preventing it (so you would obviously risk appstore rejection even if it "works"). You are not allowed to track devices. You are only allowed to track the vendor ID and advertising ID. Apple has steadily removed every other tool because those are the ones they intend you to use (and their limitations are intentional).
What you are allowed to do is track users by issuing them login credentials and having them log into your server. This usually works fine if the user actually wants the functionality you're providing by tracking them (for example, users don't mind logging into Facebook or Twitter). If you are tracking users or devices to achieve a goal the users don't actually want (such as targeted advertising that the user can't control, or attempts at digital rights management tied to devices), you're unlikely to find a supported or permitted solution.

How to find Serial Number, IMEI number using iOS SDK

In my project i want to get the serial number and IMEI number using iOS SDK, What API's we can use to get in iOS7. I went through few links where they are using IO Frameworks, If we use those Apple will reject the App. How can we got forward.
Apple does not allow you the retrieve any device specific information like IMEI, UDID, Mac address, serial number, etc..
This has to do with the misuse of these identifier and the privacy of the user.
Apple forbids retrieving such information, as this is potentially harmful to the end users. Instead they provide you with identifierForVendor:
An alphanumeric string that uniquely identifies a device to the app’s vendor. (read-only)
refs: https://developer.apple.com/library/ios/documentation/uikit/reference/UIDevice_Class/Reference/UIDevice.html#//apple_ref/occ/instp/UIDevice/identifierForVendor
If you need to distinguish different apps from same vendor(on same device) you could use advertisingIdentifier, however docs clearly states it must be used only when it is in duty of ads(whether contributing install to an ad, or presenting ads in your app). Moreover I had application rejected because it was using this id, and was not declared in iTunesConnect.
An alphanumeric string unique to each device, used only for serving advertisements. (read-only)
refs: https://developer.apple.com/library/ios/documentation/AdSupport/Reference/ASIdentifierManager_Ref/ASIdentifierManager.html#//apple_ref/occ/instp/ASIdentifierManager/advertisingIdentifier
If you still decide to go for the latter one, don't forget do add AddSupport.framework to you project settings.

Best way to store license key persistently on i-device

I have a woocommerce store with a plugin which generates license keys.
The idea is that the user of my app, will enter a license key which will be checked against a server. If it is correct then the app will create a special file/persistent flag some how.
Once activated, the user can reset the device or whatever and the app will simply check to see if this persistent file/flag is there.
My questions are:
Is there a library available specifically for this sort of thing?
If not, what is the best/standard way of doing this so the file can't be copied to another device to fake an activation?
Could I use something untouchable inside the application bundle that isn't a file to do this?
Thanks guys, some guidance or suggestions would be great.
The "standard" way to do it is to have Apple manage the licensing for you via in-app purchasing or subscriptions, they provide a secure implementation for checking if something is paid for, but this may not be an option for you.
If you need to roll it yourself, you need to use assymetric encryption, with a private key on a server that nobody can access (except you) and a public key distributed in the app. You also need the [UIDevice currentDevice].identifierForVendor.UUIDString value on the device, which is a value unique to that device which cannot be changed by the user (unless they jail break).
The server encrypts some data like 2014-03-23,purchased-three-month-license,<device-identifier-for-vendor>,<long-random-number> and gives the encrypted data to the device as the license key.
The device has the public key, and uses it to decrypt the license key. Then it checks the result to see if the date is in the last three months, the device identifier matches the device's actual identifier, and verifies that the long random number is there and at least 10 digits or something (it doesn't matter what the random number is, it just needs to be there).
Anybody who jail breaks their device will still be able to bypass your security. There is no way to prevent this. But it will take the user a lot of work, they'll probably just pay instead.
All the libraries you need for the encryption are built in, but they're low level APIs and a bit complicated to use and it's easy to screw it up. I recommend RNCryptor as a high level wrapper around them.
Also note that if the user uninstalls your app, then re-installs it (or sometimes when Xcode installs a new build) the identifierForVendor will change to a new value. Apple enforces this to protect user privacy, there's no way around it. You will need to have the server re-generate a new license key based on the new identifier... perhaps by asking the user to enter an email address and password. You can prevent piracy by monitoring how many times a particular email address is used. If they generate license keys 5 times in 30 days, then you could flag them as a pirate.
Whatever license key the "woocommerce store plugin" is generating will not work, because it won't be using [UIDevice currentDevice].identifierForVendor.UUIDString as part of the license key generation. Without that value, it's going to be trivial for anybody to pirate your software.
There is no such thing as "something untouchable inside the application bundle". The only such thing is the Secure Enclave in Apple's hardware. And to protect user privacy app developers are not allowed to use it directly. identifierForVendor is the only option.
In older versions of iOS there were more options, but they were abused by advertising companies tracking Apple's customers, and so one by one Apple has blocked access over the years.

Resources