How to track certain iPhone device IDs to prevent re-installing - ios

I am trying to figure out a way to track, or document certain device identifiers so that if someone re-installs my app, they have to use their old account. Otherwise, what is happening right now, are people are getting blocked on the app because of improper use, they are then deleting the app, re installing, and are able to make a new account. I am making it stricter with a few ideas, but one of my ideas was to track the device IDs to prevent two users from having the same device ID.
Is there any way to do this?
Thank you.

Create your own identifier and store it in the keychain (together with the other sensitive user details). This is not deleted when the app is deleted, only if the device is restored to a clean install or an old backup before the app was installed.

Related

Get unique device id for iOS?

in our iOS app, we need to identify device uniquely for licensing purpose, but I found that Apple don't provides such kind of parameters to hold users privacy & security.
After my search I found UIDevice.current.identifierForVendor, it will generate unique id but the problem is, it will be different if app got uninstalled and reinstalled back.
Somebody in SO was suggesting that storing UIDevice.current.identifierForVendor in keychain might helps. But as per my understanding if same Apple ID is used in some other device, iCloud Keychain will sync into that device too, so we will loose the license.
Is there any solution we can try? Is it possible to disable syncing of only this item in keychain? please help me :)

How to get Unique DeviceID from Xamarin IOS

I have a requirement wherein I should not allow the user to install my app in more than 1 device. This is an enterprise application and I distributed this using Enterprise developer account. Based on the Google search I use IdentifierForVendor to get unique device ID, but this doesn't seem to work now as when the user uninstalls and installs the new/same version of the app in the same device again, it returns new DeviceID. Now I am back to my old question - How to find a DeviceID for IOS?
What I think is a possible approach is to deactivate the DeviceID when the user uninstalls the application. But I am not sure how to achieve this as there are no cycle/function calls when the app is uninstalled.
Apple documentation says if all the apps from the same vendor is uninstalled from the device, then at the time of new installation of any app from that vendor will take new IdentifierForVendor.
So I would suggest store this unique id in Keychain and whenever you open the app check if there is any unique id stored in keychain if not then generate one and keep it there.
If app in uninstalled also , the key will be still there.
After you re-install the app , when you access the key in keychain it'll be still there.
This way you can achieve your objective of uniquely tracking a device.
Talking of keychain , it's worthwhile to take a look at Xamarin.Essentials Nuget.It provides many cross platform features including keychain.
Hope this helps.

"Potential Loss of Keychain Access"? Can I ignore it? Would exising app users who paid for the app have issues?

A previous developer created and uploaded our app with our dev team. They then transferred it to our client's account and released it. However it kept our Team ID. When uploading to the App store, I get the following:
"Potential Loss of Keychain Access - The previous version of software
has an application-identifier value of ['XXXXXX.XXXXXXX'] and the new
version of software being submitted has an application-identifier of
['YYYYYY.XXXXXXX']. This will result in a loss of keychain access."
I can accept losing Keychain Access as I understand that there is little that can be done here and it may not affect this app.
However, my question is, could current users be affected? There are no passwords in the app or any user details stored, it is mostly an informative app. I assume it won't stop them updating the app or block them from using their current build? These users have paid for the app, so if they stop getting access all of a sudden, they might be upset!
i.e. I'm not sure about the following technologies from Apple:
Important: The only apps that can ignore this warning without
consequences are those that do not use technologies that rely on the
App ID prefix, like keychain access, Handoff, and UIPasteboard
sharing.
I think you need to check with the developers to see if they are using anything related to the app ID prefix.
As stated by Apple, the app Prefix is critical to using a couple of their capabilities.
Basically, most of the technologies listed are all about inter-app communication. If you only offer one iOS / Mac app, you aren't doing any special interactions with other apps with the same app prefix, and you don't have anything to worry about. Pasteboard is basically a shared clipboard used to share information between apps by the same developer. Handoff is about syncing state between apps on different platforms (e.g. Sharing Safari tabs between your Mac and your iPhone).
The other thing to worry about would be the first error you show. That error means that if your app is storing any information in the keychain, the new version of the app would lose access to anything that was stored in the keychain by the old version of the app. If, like you say, your app really isn't using the keychain to store information (it doesn't have to just be passwords, FYI), you don't need to worry about that either.
I would definitely have the developers check for anything related to the keychain to confirm, as well as anything related to the PasteBoard or Handoff.
EDIT
As to the affect on current app users, they should not be affected if you are not using any of the above technologies. Existing users will get the update and should not notice any difference. More on that in this answer.

Use Keychain To Store Device Identifier

I noticed that my identifierForVendor always changes. Someone told me that it doesn't change when you download from iTunes. I'm not so sure about it, though. So, I want to store the first identifierForVendor generated. I found this class, JNKeychain from one of the posts i checked. It can store password and other data. I tried using that to store my identifierForVendor. Even after deleting my app and reinstalling using XCode, I was able to get the value I stored. Sounds good because this way, my identifierForVendor can persist regardless of whether it was downloaded from iTunes or not. However, I"m not very familiar with Keychain. I didn't even know we can store secure data using it. I read their documentation and it says there it's usually used to share data between applications and your apps should have same provisioning profile etc... I don't plan on sharing. I just want it to save my identifier so this is not a concern for me. My only concern is how long will my data last in the keychain storage? Will it be deleted after some time? or when I turn off my device? When i update ios version? Can it persist forever? Will keychain have a different behavior if I use developer/distribution profile?
The keychain entry will last as long as the device is not wiped or hard-reset or until the app deletes it. Apps can be deleted and replaced, but the keychain entry will remain. If an app from developer profile is overlaid with enterprise profile or app store the keychain entry should be fine.

Application preferences after remove app

Is application preference stay after remove app, or after reinstall app I get cleared preferences?
I save UUID in preferences and want to know is there will be same UUID if I remove app and reinstall it after long time.
Update:
Is preferences backed up with iCloud and(or) iTunes and restore after reinstall app?
Thanks a lot!
Applications are stored in a sandbox. This means every application has its own directory, its own working space.
In that working space all data of the application gets stored. This includes documents, library files, temporary files, the application bundle, as well as the preferences file.
When a user chooses to delete an app, the whole sandbox gets removed, including those preferences.
You the answer is yes. When a user deletes and reinstals your application, his preferences will be reset.
I can tell that NSUserDefaults keep info after reinstalling app.
After removing nothing will be saved, I guess.
You can make hash from device UDID and make it unique identifier for you customers.
Don't save or transport unhasned UDIDs without users permission! Keep it hashed. You can recount hash after reinstalling or removing and another installing and it will be the same every time.
Not exactly about settings, but I hope it will help you.

Resources