iOS:如何在應用程序中存儲用戶名/密碼? - iOS: How to store username/password within an app?

問題:

I have a login-screen in my iOS app.我的 iOS 應用中有一個登錄屏幕。 The username and password will be saved in the NSUserDefaults and be loaded into the login-screen again when you enter the app again (of course, NSUserDefaults are permanent).用戶名和密碼將保存在NSUserDefaults並在您再次進入應用程序時再次加載到登錄屏幕(當然, NSUserDefaults是永久的)。

Now, the user have the possibility to disable the username/password saving feature.現在,用戶可以禁用用戶名/密碼保存功能。

So the NSUserDefaults will be cleared then.所以NSUserDefaults將被清除。

But In my app I need this username/password for database queries for the user.但是在我的應用程序中,我需要這個用戶名/密碼來爲用戶查詢數據庫。 So: Where to store the data except NSUserDefaults ?那麼:除了NSUserDefaults之外,在哪裏存儲數據? (This place can / should be deleted when the user quit the app or logout). (當用戶退出應用程序或註銷時,這個地方可以/應該被刪除)。


解決方案:

參考一: https://en.stackoom.com/question/TFl6
參考二: https://stackoom.com/question/TFl6
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章