我正在Objective C中開發應用程序,一切都很酷,但我真的很新,所以我想知道是否有一種方法可以將會話從已經登錄到我的應用程序的用戶,我保存用戶名+密碼,因爲我稍後使用它們,但是當我關閉該應用程序時(殺死它),我必須再次登錄,所以我希望你們可以幫助我與此:保存會話,即使應用程序被終止目標C
下面是我在我的代碼保存會話:
NSString *user = [textUser text];
NSString *password = [textPassword text];
[[NSUserDefaults standardUserDefaults] setObject:user forKey:@"userName"];
[[NSUserDefaults standardUserDefaults] setObject:password forKey:@"userPassword"];
[[NSUserDefaults standardUserDefaults] synchronize];//here is where i save the user info but i want it to stay even if the app is killed
所以我想我需要的是來檢查,如果是NSUserDefaults的空或不是,然後直奔我的首頁的方法小號creen-activity
謝謝!
太棒了,享受編碼。 –