I implement in-app purchases and all the products are non-consumable. My intention is to store bool values in the keychain for every product identifier, and later control the Core Data retrieves according to the stored bool values.
My question is: How can I store key/bool values into the keychain?
P.S: I use KeyChainItemWrapper.
Store it in form of
NSNumber
as it contains a special method+ numberWithBool:
to convert BOOL value to an object:and to fetch:
Use either of keychain key
kSecAttrIsInvisible
andkSecAttrIsNegative
as these supports to store bool values.I don't understand a few things. Why do you need to store the bool values in the keychain? Also, how will Core Data communicate with the keychain or depend on it? The question is a bit vague.
Look at this year's WWDC session on Touch ID and the Keychain (or last year's Keychain session) for the attributes you use to setup the keychain and communicate with it. Also look at Apple's sample project from this year.
The docs have a lot of info on the possible keys you can use and how to communicate with the keychain.