Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

better error checking for when data is not parsed

  • Loading branch information...
commit ce44fd89cd4fa4fa00a2e457c79aa686dcbdf8fb 1 parent 14ee6ca
@zachgraves zachgraves authored
View
7 Source/YOSSocial/YOSAccessToken.m
@@ -26,7 +26,12 @@ @implementation YOSAccessToken
+ (YOSAccessToken *)tokenFromResponse:(NSData *)responseData
{
- NSDictionary *tokenDictionary = [responseData OAuthTokenResponse];
+ NSDictionary *tokenDictionary = nil;
+ @try {
+ tokenDictionary = [responseData OAuthTokenResponse];
+ } @catch (id responseException) {
+ return nil;
+ }
NSInteger tokenExpires = [[tokenDictionary valueForKey:@"oauth_expires_in"] intValue];
NSInteger authExpires = [[tokenDictionary valueForKey:@"oauth_authorization_expires_in"] intValue];
View
7 Source/YOSSocial/YOSRequestToken.m
@@ -23,7 +23,12 @@ @implementation YOSRequestToken
+ (YOSRequestToken *)tokenFromResponse:(NSData *)responseData
{
- NSDictionary *tokenDictionary = [responseData OAuthTokenResponse];
+ NSDictionary *tokenDictionary = nil;
+ @try {
+ tokenDictionary = [responseData OAuthTokenResponse];
+ } @catch (id responseException) {
+ return nil;
+ }
BOOL isCallbackConfirmed = [[tokenDictionary valueForKey:@"oauth_callback_confirmed"] isEqualToString:@"true"];
NSInteger tokenExpires = [[tokenDictionary valueForKey:@"oauth_expires_in"] intValue];
Please sign in to comment.
Something went wrong with that request. Please try again.