OStack程序员社区-中国程序员成长平台

标题: ios - PFFacebookUtil 超时错误 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 19:10
标题: ios - PFFacebookUtil 超时错误

我遇到了与此处所述类似的问题:https://www.parse.com/questions/error-when-trying-to-reauthorise-facebook-user

当我的应用启动时,如果用户已经登录,它会尝试从 Facebook 获取用户的个人资料图片:

- (void)getFacebookIdAndProfileImageWithSuccessvoid(^)(NSDictionary *))success {
    // Send request to Facebook to retrieve profile information
    FBRequest *request = [FBRequest requestForMe];
    [request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
        if (error)
            return;

        // Result is a dictionary of user information
        NSMutableDictionary *userData = (NSMutableDictionary *)result;

        NSString *facebookId = userData[@"id"];
        [userData setObject:facebookId forKey"facebookId"];

        // Retrieve the user profile image
        NSURL *imageUrl = [NSURL URLWithString:[NSString stringWithFormat"%@/%@/picture?height=55&width=55", BaseApiUrl, facebookId]];
        UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:imageUrl]];
        [userData setObject:image forKey"image"];
        [userData setObject:[imageUrl absoluteString] forKey"imageUrl"];

        success([NSDictionary dictionaryWithDictionary:userData]);
    }];
}

好吧,请求返回需要很长时间,当它返回时它会报告错误:

"Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x146aa790 {com.facebook.sdk:ErrorInnerErrorKey=Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x146a1710 {NSErrorFailingURLStringKey=https://graph.facebook.com/, 
NSErrorFailingURLKey=https://graph.facebook.com/, NSLocalizedDescription=The request timed out., NSUnderlyingError=0x1455c110 "The request timed out."}, com.facebook.sdk:HTTPStatusCode=200, com.facebook.sdk:ErrorSessionKey=<FReceptionist: 0x14685310>}"



Best Answer-推荐答案


我删除了我的应用程序并重新安装了它。这解决了这个问题。问题可能是在我开始收到此错误之前,我试图解决我的应用程序遇到的另一个 Facebook 相关问题。我尝试的其中一件事是删除我的 Facebook 帐户设置 > Facebook。也许这与这个错误有关,我不确定。

关于ios - PFFacebookUtil 超时错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21937954/






欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) Powered by Discuz! X3.4