Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FBAccessTokenData EXC_BAD_ACCESS when refreshing access token

I've started to receive crash logs through crashlytics after updating Facebook SDK from 3.5.3 to 3.9 in my app about an EXEC_BAD_ACCESS crash in FBAccessTokenData.m line 126

The crash doesn't reference the part in my app where this is getting called, unfortunately, and I've been unable to reproduce it, so I can't pinpoint where exactly in my app is causing this.

If is of any use, all crashes have been in iPhones running iOs 7.

Crash Log: crashlytics screen cap

line 126:

if (accessToken == nil || [accessToken stringByTrimmingCharactersInSet:
                           [NSCharacterSet whitespaceCharacterSet]].length == 0) {

in

+ (FBAccessTokenData *) createTokenFromString:(NSString *)accessToken
                              permissions:(NSArray *)permissions
                           expirationDate:(NSDate *)expirationDate
                                loginType:(FBSessionLoginType)loginType
                              refreshDate:(NSDate *)refreshDate
                   permissionsRefreshDate:(NSDate *)permissionsRefreshDate
{
if (accessToken == nil || [accessToken stringByTrimmingCharactersInSet:
                           [NSCharacterSet whitespaceCharacterSet]].length == 0) {
    return nil;
}
if (expirationDate == nil) {
    expirationDate = [NSDate distantFuture];
}
if (refreshDate == nil) {
    refreshDate = [NSDate date];
}
if (permissionsRefreshDate == nil) {
    permissionsRefreshDate = [NSDate distantPast];
}

FBAccessTokenData* fbAccessToken = [[FBAccessTokenData alloc] initWithToken:accessToken
                                                                permissions:permissions
                                                             expirationDate:expirationDate
                                                                  loginType:loginType
                                                                refreshDate:refreshDate
                                                     permissionsRefreshDate:permissionsRefreshDate];
return [fbAccessToken autorelease];
}
like image 474
asendra Avatar asked Nov 19 '13 18:11

asendra


2 Answers

We've looked in to this issue and it appears to be a bug in the Facebook iOS SDK.

Reverting the pod by using the following podspec line has stopped us seeing this.

pod 'Facebook-iOS-SDK', '~>3.8.0'
like image 107
Chris Maddern Avatar answered Nov 20 '22 09:11

Chris Maddern


This has been fixed in version 3.11.1 of the SDK.

like image 1
Chris Pan Avatar answered Nov 20 '22 11:11

Chris Pan