简体   繁体   中英

How do I determine that my app was just downloaded from AppStore the first time?

This is how it is accomplished in my app:

  • I keep the data in iCloud.
  • I need to do some time consuming thing for users who already used my app. But this will also start for completely new users... they just downloaded my app from AppStore for the first time. And this is not expected.

How can I determine that the app is running, but downloaded from AppStore for the first time?

What I could do, but I did not:

  • put any boolean data in the Keychain, and then check if it exists.

Since you have no non-app end to distinguish users Keychain as you mentioned is your only app persistance option that will survive app uninstalling. Only device Reset to factory settings would remove it.

you can use NSUserDefaults . if appDelegate.m ->didFinishLaunchingWithOptions use this code :

NSUserDefaults * userDefaults = [NSUserDefaults standardUserDefaults];
if([userDefaults objectForKey:@"first_time"] == nil){
     [userDefaults setObject:@"1" forKey:@"first_time"];

     //do whatever you need
}

this condition will satisfied only once after installation .

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