开发者

Is there any way to identify that my app is executing first time on iphone?

开发者 https://www.devze.com 2023-02-28 05:21 出处:网络
I want to show a message of instructions when user first time use my application, but then never until he won\'t delete it and re-download,,,

I want to show a message of instructions when user first time use my application, but then never until he won't delete it and re-download,,,

one easy way is to sav开发者_如何学JAVAe some value in sqlite3 database and match it, but I want to use something else,,,,


You can do anything the other answerers suggested, or just check for a certain file (call it firstrun.txt) under app "Documents" directory to exist at startup.

If it doesn't exist, show the welcome message and create it, otherwise, do nothing. When the user updates the app, the "Documents" directory doesn't get emptied.

That's it.


I'd use NSUserDefaults:

if ([[NSUserDefaults standardUserDefaults] boolForKey:kHasRun] == NO) { 

    // do something

    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:kHasRun];
}


you ca use sqlite or plist or [NSUserDefaults standardUserDefaults] for saving value.

0

精彩评论

暂无评论...
验证码 换一张
取 消