I'd like to use Keychain Services
for iOS to store the OAuth access token and refresh token that my app need to perform Web services requests. I've been reading the Keychain Services Programming Guide and I downloaded the GenericKeychain sample code, but I'm getting confused:
- Code provided in document is different from the sample code... which approach should I follow?
- I read somewhere that you need to enable
Data Protection
in Member Center for the App ID and its associated provisioning profile. However, I didn't read anything about enablingData Protection
in Xcode for the target's capabilities, and it seems that I could access the keychain anyway... this is weird, but I guess I should enableData Protection
in the Xcode project as well, right? Where is thisData Protection
stuff described in Apple's docs? Is it somewhere said that I need to enable it forKeychain
management? I don't find it... - Samples I found use the
kSecClassGenericPassword
class for the keychain items. Since I want to manage OAuth related information, is there any better class I should use? MaybekSecClassInternetPassword
? What is the difference withkSecClassGenericPassword
? - Is it recommended to instantiate a kind of
KeychainWrapper
class, or would it be better to access keychain related methods as class methods?
Thanks in advance