Parse login hang since Facebook 4.0.x with [PFFacebookUtils initializeFacebookWithApplicationLaunchOptions:launchOptions] (semaphore_wait_slow trap)

570 views Asked by At

Since updating Facebook to v4.0.x and the latest Parse libraries, my app is hanging, seemingly when trying to log in the user.

My stack trace looks like this:

enter image description here

I had a very similar problem previously, answered here: Parse crash when calling [PFFacebookUtils initializeFacebook] - semaphore_wait_trap

However that solution no longer works, since it seems [PFUser currentUser] has been replaced with [PFUser(Private) _getCurrentUserWithOptions:] and [BFTask(Private) waitForResult:withMainThreadWarning:] where it gets stuck.

In my app, I've subclassed PFUser to a class called MPLUser, and overridden the user method. Not sure if this might be something to do with the issue?

+ (MPLUser *)user
{
    return (MPLUser *)[PFUser user];
}

Once this starts occurring, it becomes impossible to launch the app. However, I usually manage to launch the app a few times before the lock starts happening. It usually happens after a crash...

I'm using pod 'ParseFacebookUtilsV4' and have updates all libraries to latest versions.

UPDATE:

Here's more stack trace from another thread, that is seemingly trying to log on:

enter image description here enter image description here

I initialise Parse and Facebook in the following order. If I reverse the calls, it crashes:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [self initDefaults];
    [self initialiseApplicationSpecifics];
    [self setupParseWithOptions:launchOptions];
    [self enableCrashReporting];
    [self setupIAPs]; 
//etc... 
}


- (void)initialiseApplicationSpecifics
{
    [Flurry setCrashReportingEnabled:YES];
    [self registerParseSubclasses];
    [ParseCrashReporting enable];
    [Parse enableLocalDatastore];
#ifdef MPL
    [Parse setApplicationId:@"xxxyyy"
                  clientKey:@"xxxyyy"];
    [Flurry startSession:@"xxxyyy"];
#elif MGM
    [Parse setApplicationId:@"yyyxxx"
                  clientKey:@"yyyxxx"];
    [Flurry startSession:@"yyyxxx"];
#endif
}

- (void)setupParseWithOptions:(NSDictionary *)launchOptions
{
    [PFFacebookUtils initializeFacebookWithApplicationLaunchOptions:launchOptions];
    [PFTwitterUtils initializeWithConsumerKey:@"aaaabbbb"
                               consumerSecret:@"bbbbaaaa"];
    [PFAnalytics trackAppOpenedWithLaunchOptions:launchOptions];
}
3

There are 3 answers

0
Liron On BEST ANSWER

Seems to be fixed with parse 1.7.2

According to v1.7.2 — April 27, 2015

New: Local Data Sharing for Extensions and WatchKit. Improved nullability annotations for ParseFacebookUtils.
Fixed: logOutInBackground with block callback not called on main thread. Fixed: Potential compilation error with using imports for PFSubclassing.h.
Fixed: Not persistent currentUser if saving automatic user via saveEventually.
Fixed: Rare deadlock scenario with using ParseFacebookUtils and currentUser.
Fixed: Rare issue with pinning multiple objects in a row to the same pin.
Fixed: Rare scenario when user could be not linked with Facebook.
Improved performance and reliability of Local Datastore. Performance improvements.
Other small bug fixes.

4
Eric Nakagawa - Parse Dev Adv On

I checked with my team working on the iOS SDK and was informed the latest SDK should resolve this. Can you try updating?

0
Daniele Pizziconi On

I'm having the same problem with Parse 1.7.1 & FBSDK 4.0.1 and I reported the bug to Parse but with no luck so far. It has something to do with the local datastore.

https://developers.facebook.com/bugs/779176035499837

Please provide further info there.