使用 [PFFFacebookUtils initializeFacebookWithApplicationLaunchOptions:launchOptions] 解析自 Facebook 4.0.x 以来的登录挂起(semaphore_wait_slow 陷阱)

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

自从将 Facebook 更新到 v4.0.x 和最新的 Parse 库后,我的应用程序挂起,似乎是在尝试登录用户时。

我的堆栈跟踪如下所示:

我之前遇到过非常相似的问题,在这里回答:

但是该解决方案不再有效,因为似乎 [PFUser currentUser] 已被卡住的 [PFUser(Private) _getCurrentUserWithOptions:][BFTask(Private) waitForResult:withMainThreadWarning:] 取代。

在我的应用程序中,我将 PFUser 子class 到一个名为 MPLUser 的 class,并覆盖了用户方法。不确定这是否与问题有关?

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

一旦出现这种情况,就无法启动该应用程序。但是,我通常会在锁定开始之前设法启动应用程序几次。它通常发生在崩溃之后...

我正在使用 pod 'ParseFacebookUtilsV4' 并将所有库更新到最新版本。

更新:

这是来自另一个似乎正在尝试登录的线程的更多堆栈跟踪:

我按以下顺序初始化 Parse 和 Facebook。如果我撤销调用,它会崩溃:

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

我与开发 iOS SDK 的团队进行了核实,得知最新的 SDK 应该可以解决这个问题。你能试试更新吗?

我在 Parse 1.7.1 和 FBSDK 4.0.1 上遇到了同样的问题,我向 Parse 报告了这个错误,但到目前为止还没有成功。跟本地数据存储有关。

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

请提供更多信息。

似乎已通过解析 1.7.2 修复

根据 v1.7.2 — 2015 年 4 月 27 日

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.