i have followed "GenericKeychain" sample app from apple & already able to write a string into keychain & also able to read it from keychain.
But i am wondering how can i store an array of string inside keychain, Is it possible ? How ?
You can only store objects of type CFDataRef (which is toll-free bridged to NSData) in a keychain.
To store an array of strings you would typically use property list serialization:
NSArray *myArray = @[@"my", @"strings"];
NSData *data = [NSPropertyListSerialization dataWithPropertyList:myArray format: NSPropertyListBinaryFormat_v1_0 options:0 error:NULL];
Now you can put data into the keychain.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With