Error posting video to Facebook using SDK for iOS

后端 未结 3 535
猫巷女王i
猫巷女王i 2021-02-15 10:27

I have an app that posts native (MOV files) video to Facebook using the Facebook SDK for iOS. It worked without problems till a few weeks ago where it started failing with the f

相关标签:
3条回答
  • 2021-02-15 11:12

    Answers above work. But make sure you created the Facebook session, with openActiveSessionWithPublishPermissions not openActiveSessionWithReadPermissions.

    I spent a day on this, because if you use the wrong one, you get the (in)famous "(#352) Sorry, the video file you selected is in a format that we don't support."

    In any case the only permission you really need is publish_actions

    0 讨论(0)
  • 2021-02-15 11:17

    I don't use key contentType int params. It works well with Facebook SDK 3.10 (latest)

    NSData *videoData = [NSData dataWithContentsOfFile:filePath];    
    NSString* videoName = [filePath lastPathComponent];
    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
    [params setObject:caption forKey:@"description"];
    [params setObject:videoData forKey:videoName];
    
    FBRequestConnection *requestConnection = [FBRequestConnection startWithGraphPath:@"me/videos"
                                 parameters:params
                                 HTTPMethod:@"POST"
                          completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
    {
    
    }];
    
    0 讨论(0)
  • 2021-02-15 11:34

    Just before FBRequest Add a line to open FBRequestConnection Worked for me.

    [FBRequestConnection startWithGraphPath:@"me/videos" 
        completionHandler:^(FBRequestConnection *connection, 
        id result, NSError *error) 
    {
        FBRequest *uploadRequest = 
            [FBRequest requestWithGraphPath:@"me/videos" 
            parameters:params HTTPMethod:@"POST"];
    }];
    
    0 讨论(0)
提交回复
热议问题