سؤال

I'm using the UICKeyChainStore framework to save data to keychain.

How can I verify that the data is saved to the keychain?

هل كانت مفيدة؟

المحلول

You can get data back after storing in this way:

NSString *name = [UICKeyChainStore stringForKey:@username" service:@"username"];

and then compare the strings to make sure that the value is saved

Alternatively, you can also use the following library. https://gist.github.com/dhoerl/1170641

نصائح أخرى

UICKeyChainStore's setString forKey method returns the bool value , You can add a check on it.

BOOL result = [UICKeyChainStore setString:@"value" forKey:@"key"];
    if (result) {
        NSLog(@"data saved successfully");
    } else {
        NSLog(@"problem in saving");
    }
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top