Permalink
Browse files

Log keychain errors

  • Loading branch information...
1 parent d11e73f commit 1a49ed9ac281b3350aaaa24ae91f7f0031d3b6d0 @soffes soffes committed Aug 21, 2012
Showing with 10 additions and 3 deletions.
  1. +10 −3 CheddarKit/CDKUser.m
View
@@ -41,9 +41,11 @@ + (CDKUser *)currentUser {
if (!userID) {
return nil;
}
-
- NSString *accessToken = [SSKeychain passwordForService:kCDKKeychainServiceName account:userID.description];
+
+ NSError *error = nil;
+ NSString *accessToken = [SSKeychain passwordForService:kCDKKeychainServiceName account:userID.description error:&error];
if (!accessToken) {
+ NSLog(@"[CheddarKit] Failed to get access token: %@", error);
return nil;
}
@@ -65,7 +67,12 @@ + (void)setCurrentUser:(CDKUser *)user {
__currentUser = nil;
[userDefaults removeObjectForKey:kCDKUserIDKey];
} else {
- [SSKeychain setPassword:user.accessToken forService:kCDKKeychainServiceName account:user.remoteID.description];
+ NSError *error = nil;
+ [SSKeychain setPassword:user.accessToken forService:kCDKKeychainServiceName account:user.remoteID.description error:&error];
+ if (error) {
+ NSLog(@"[CheddarKit] Failed to save access token: %@", error);
+ }
+
__currentUser = user;
[userDefaults setObject:user.remoteID forKey:kCDKUserIDKey];
}

0 comments on commit 1a49ed9

Please sign in to comment.