我假定你们会实现这一点,但你需要储存日志的全权证书,我假定你的问题是怎样?
如果你想把标识证书储存在一生中(在你关闭时,这些证书就被贴上标签),那么我会把全球级变量储存起来,以便它们能够从这里的任何地方参考。
If you want to keep the login credentials stored longer (i.e. they may still be logged in if they close and reopen the app), you should use NSUserDefaults:
写作:
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"UserIsLoggedIn"];
[[NSUserDefaults standardUserDefaults] synchronize];
阅读:
BOOL loggedIn = [[NSUserDefaults standardUserDefaults] boolForKey:@"UserIsLoggedIn"];
还请注意以下考虑:
- UserDefaults aren t secure. Please don t store passwords there without encrypting them.
boolForKey:
returns NO if the key you provide doesn t exist