How to upload/share video on Facebook ?

前端 未结 3 972
不知归路
不知归路 2021-02-04 20:16

I am making a test app through that I want to post video on facebook. I am using latest sdk of facebook. But I am not able to post it on facebook.

My code is as below.<

3条回答
  •  Happy的楠姐
    2021-02-04 20:51

    Get the publish permission

    NSArray* permissions = [[NSArray alloc] initWithObjects:
                                @"publish_stream", nil];
        [facebook authorize:permissions delegate:self];
        [permissions release];
    

    Try this

    - (void)fbDidLogin {
        NSString *filePath = [[NSBundle mainBundle] pathForResource:@"sample" ofType:@"mov"];
        NSData *videoData = [NSData dataWithContentsOfFile:filePath];
        NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                       videoData, @"video.mov",
                                       @"video/quicktime", @"contentType",
                                       @"Video Test Title", @"title",
                                       @"Video Test Description", @"description",
                           nil];
        [facebook requestWithGraphPath:@"me/videos"
                             andParams:params
                         andHttpMethod:@"POST"
                           andDelegate:self];
    }
    

提交回复
热议问题