facebook.sdk error 5 Objective-C



我是objective-c的新手,我真的需要你的帮助。我已经想了好几个小时了。但我还是找不到解决办法。以下是我的代码:

-(void)post
{
        [self connectWithFacebook];
        NSLog(@"session: %hhd", FBSession.activeSession.isOpen);
        NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Here's to the Crazy Ones" ofType:@"mp4"];
        NSURL *pathURL = [[NSURL alloc]initFileURLWithPath:filePath isDirectory:NO];
        NSData *videoData = [NSData dataWithContentsOfFile:filePath];
        NSDictionary *videoObject = @{
                                      @"title": @"FB SDK 3.1",
                                      @"description": @"hello there !",
                                      [pathURL absoluteString]: videoData
                                      };
        FBRequest *uploadRequest = [FBRequest requestWithGraphPath:@"me/videos"
                                                        parameters:videoObject
                                                        HTTPMethod:@"POST"];
        NSLog(@"here i am");
        [uploadRequest startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
        NSLog(@"after upload request");
            if (!error)
                NSLog(@"Done: %@", result);
            else
                NSLog(@"Error: %@", error.localizedDescription);
        }];
}

- (void) connectWithFacebook {
    AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
    [appDelegate openSessionWithAllowLoginUI:YES];
}

这是来自AppDelegate

- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI
{
    NSArray *permissions = @[@"publish_stream"];
    return [FBSession openActiveSessionWithReadPermissions:permissions
                                              allowLoginUI:allowLoginUI
                                         completionHandler:^(FBSession *session, FBSessionState state, NSError *error) {
                                             if (error) {
                                                 NSLog (@"Handle error %@", error.localizedDescription);
                                             } else {
                                                 NSLog(@"No error");
                                             }
                                         }];
}

来自控制台:

2014-05-08 15:02:49.385 camera[3748:60b]错误:操作无法完成。(com.facebook。SDK错误5.)

非常感谢你的帮助。谢谢你!我真的不知道下一步该做什么。

com.facebook.sdk错误5的一个可能错误是

"此状态更新与您上次发布的状态相同。"试一试发布一些不同的东西,或者删除你以前的更新。"

相关内容

  • 没有找到相关文章

最新更新