Reputation: 31
I've search a lot of that and as conclusion:
But as far as I know, all these ids can be change by users, and keychain can be disabled in icloud setting. Some says use NSUserDefault
but this will be removed once remove the app.
What I want to achieve is detect first run on a specific device even uninstall and reinstall.
I am new to ios dev, can some one help? thanks in advance.
Upvotes: 0
Views: 141
Reputation: 201
Getting the Vendor-ID and storing it to Keychain is the best way you can achieve your requirement.
Upvotes: 1
Reputation: 21013
Try reading a key out of UserDefaults
that you know won't exist.
if UserDefaults.standard.bool(forKey: "YourAppNamePrefixHasRunBefore") {
// do whatever you need to do
UserDefaults.standard.set(true, forKey: "YourAppNamePrefixHasRunBefore") // set the key so on the next run this test fails
}
You may need to validate syntax, but it should be pretty close.
Upvotes: 0