I'm working on an app that uses an auth key to validate the login session for many methods (like getFriends, for example). I'll be calling these methods in different view controllers to the one which manages logging in, so I need a way to store the auth_key which is returned upon login.

Should I use a global variable? Also how is this best done? Is this what the "keychain" is for? Could you provide some resources for learning how to use the keychain?

I'm a first year student so please don't assume much experience.

有帮助吗?

解决方案

for this case I would use the keychain. Carl Brown wrote a great Controller to simply use the keychain. You can find it here: https://github.com/carlbrown/PDKeychainBindingsController

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top