Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change made to TCTrueSDK for iOS crash when user response is nil #23

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions TrueSDK/External/TCTrueSDK.m
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,17 @@ - (BOOL)application:(nonnull UIApplication *)application
[self.delegate didReceiveTrueProfileResponse:response];
}

NSData *decodedData = [[NSData alloc] initWithBase64EncodedString:response.payload options:0];
NSError *serializationError = nil;
NSDictionary *profileDict = [NSJSONSerialization JSONObjectWithData:decodedData options:0 error:&serializationError];
TCTrueProfile *profile = [[TCTrueProfile alloc] initWithDictionary:profileDict];
[self.delegate didReceiveTrueProfile:profile];
// Case added for response nil when the login button is fired before fetching details of user
if (response != nil) {
NSData *decodedData = [[NSData alloc] initWithBase64EncodedString:response.payload options:0];
NSError *serializationError = nil;
NSDictionary *profileDict = [NSJSONSerialization JSONObjectWithData:decodedData options:0 error:&serializationError];
TCTrueProfile *profile = [[TCTrueProfile alloc] initWithDictionary:profileDict];
[self.delegate didReceiveTrueProfile:profile];
} else {
retValue = NO;
}

}

retValue = YES;
Expand Down