سؤال

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