その時点でアプリケーションを初めて起動するのboolForKey:@"AlreadyRan"
はですFALSE
。その後、それを設定しTRUE
ます。
if(![[NSUserDefaults standardUserDefaults] boolForKey:@"AlreadyRan"] )
{
[[NSUserDefaults standardUserDefaults] setBool:TRUE forKey:@"AlreadyRan"];
}
NSUserDefaultsクラスを使用すると、アプリケーションまたはユーザーデータに関連する設定とプロパティを保存できます。
The objects will be saved in what is known as the iOS “defaults system”.
The iOS defaults system is available throughout all of the code in your app, and any data saved to the defaults system will persist through application sessions.This means that even if the user closes your application or reboots their phone, the saved data will still be available the next time they open the app!