0

我正在使用 facebook sdk 上传视频,但我无法在 facebook 上上传超过 60MB 的视频。我也尝试了很多使用 NSInputStream 来发送数据和所有:-

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

    FBRequest *request = [FBRequest requestWithGraphPath:@"me/videos" parameters:params HTTPMethod:@"POST"];

    [request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
        NSLog(@"result: %@, error: %@", result, error);
    }];
4

1 回答 1

4

请改用 dataWithContentsOfFile:options 。不会尝试将所有数据加载到内存中,这可能会使您的应用程序被 iOS 关闭:

NSData *videoData = [NSData dataWithContentsOfFile:video.localURL options:NSDataReadingMappedAlways error:&error];
于 2013-03-26T14:07:20.870 回答