用iOS SDK将大video上传到Facebook

如何在iOS Facebook SDK中上传大video? 我有一个4分钟的video,总是出现一个未知的错误。

我不得不为video参数构build我的NSData像这样:

videoData = [NSData dataWithContentsOfURL:url options:NSDataReadingMappedAlways error:&error]; 

我也不得不在FBRequestConnection.m中改变这个方法,并开始工作:

 // // Generates a URL for a batch containing only a single request, // and names all attachments that need to go in the body of the // request. // // The URL contains all parameters that are not body attachments, // including the session key if present. // // Attachments are named and referenced by name in the URL. // - (NSString *)urlStringForSingleRequest:(FBRequest *)request forBatch:(BOOL)forBatch { [request.parameters setValue:@"json" forKey:@"format"]; [request.parameters setValue:kSDK forKey:@"sdk"]; NSString *token = request.session.accessTokenData.accessToken; if (token) { [request.parameters setValue:token forKey:kAccessTokenKey]; [self registerTokenToOmitFromLog:token]; } NSString *baseURL; if (request.restMethod) { if (forBatch) { baseURL = [kBatchRestMethodBaseURL stringByAppendingString:request.restMethod]; } else { baseURL = [kRestBaseURL stringByAppendingString:request.restMethod]; } } else { if (forBatch) { baseURL = request.graphPath; } else { NSString *const kVideoGraphBaseURL = @"https://graph-video." FB_BASE_URL @"/"; if (([request.HTTPMethod isEqualToString:@"PUT"] || [request.HTTPMethod isEqualToString:@"POST"]) && [request.graphPath rangeOfString:@"videos"].location != NSNotFound) { baseURL = [kVideoGraphBaseURL stringByAppendingString:request.graphPath]; } else { baseURL = [kGraphBaseURL stringByAppendingString:request.graphPath]; } } } NSString *url = [FBRequest serializeURL:baseURL params:request.parameters httpMethod:request.HTTPMethod]; return url; } 

iOS SDK中的video支持看起来很差。