我正在使用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);
}];
答案 0 :(得分:4)
使用dataWithContentsOfFile:选项。不会尝试将所有数据加载到内存中,这可能会使您的应用程序被iOS关闭:
NSData *videoData = [NSData dataWithContentsOfFile:video.localURL options:NSDataReadingMappedAlways error:&error];