こんな感じで使う。
[[LUKeychainAccess standardKeychainAccess] setBool:NO forKey:@"authorized"]; BOOL authorized = [[LUKeychainAccess standardKeychainAccess] boolForKey:@"authorized"];
API
// Public Methods + (LUKeychainAccess *)standardKeychainAccess; // Getters - (BOOL)boolForKey:(NSString *)key; - (NSData *)dataForKey:(NSString *)key; - (double)doubleForKey:(NSString *)key; - (float)floatForKey:(NSString *)key; - (NSInteger)integerForKey:(NSString *)key; - (id)objectForKey:(NSString *)key; - (NSString *)stringForKey:(NSString *)key; // Setters - (void)setBool:(BOOL)value forKey:(NSString *)key; - (void)setData:(NSData *)data forKey:(NSString *)key; - (void)setDouble:(double)value forKey:(NSString *)key; - (void)setFloat:(float)value forKey:(NSString *)key; - (void)setInteger:(NSInteger)value forKey:(NSString *)key; - (void)setObject:(id)value forKey:(NSString *)key; - (void)setString:(NSString *)inputString forKey:(NSString *)key;
Keychain に保管した情報はアプリを削除しても残るのでそれを利用した用途に適していると思われる。
(参考)
0 件のコメント:
コメントを投稿