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

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 13:05:08

问题


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:

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:

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];
}

回答1:


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.




回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/29695690/parse-login-hang-since-facebook-4-0-x-with-pffacebookutils-initializefacebookwi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!