- (void)saveAuthorizeDataToKeychain
{
NSString *serviceName = @"itemName";
[SFHFKeychainUtils storeUsername:kWBKeychainUserID andPassword:self.userID forServiceName:serviceName updateExisting:YES error:nil];
[SFHFKeychainUtils storeUsername:kWBKeychainPassword andPassword:self.password forServiceName:serviceName updateExisting:YES error:nil];
[SFHFKeychainUtils storeUsername:kWBKeychainExpireTime andPassword:[NSString stringWithFormat:@"%lf", self.expireTime] forServiceName:serviceName updateExisting:YES error:nil];
}
- (void)readAuthorizeDataFromKeychain
{
NSString *serviceName = @"itemName";
self.userID = [SFHFKeychainUtils getPasswordForUsername:kWBKeychainUserID andServiceName:serviceName error:nil];
self.password = [SFHFKeychainUtils getPasswordForUsername:kWBKeychainPassword andServiceName:serviceName error:nil];
self.expireTime = [[SFHFKeychainUtils getPasswordForUsername:kWBKeychainExpireTime andServiceName:serviceName error:nil] doubleValue];
}
- (void)deleteAuthorizeDataInKeychain
{
self.userID = nil;
self.password = nil;
self.expireTime = 0;
NSString *serviceName = @"itemName";
[SFHFKeychainUtils deleteItemForUsername:kWBKeychainUserID andServiceName:serviceName error:nil];
[SFHFKeychainUtils deleteItemForUsername:kWBKeychainPassword andServiceName:serviceName error:nil];
[SFHFKeychainUtils deleteItemForUsername:kWBKeychainExpireTime andServiceName:serviceName error:nil];
}