Search code examples
iosobjective-ckeychain

Are NSString and NSData the only types I can insert into KeyChain?


You can convert an integer to NSString or an array to NSData and insert them into the iOS KeyChain.

My question is: Is that it? Or is there a direct way to insert a double, float or a boolean?


Solution

  • You can store primitive types in form of NSNumber and save them to keychain. It has methods like: numberWithBool:, numberWithInteger:, numberWithFloat:.

    Here and here are examples of storing BOOL in keychain.