更新时间:2023-12-02 15:57:16
这是一个古老的问题,但是最新的Facebook iOS SDK v3.9可以实现您想做的事情. (2013年10月27日)
This is an old question but what you're trying to do is possible with latest Facebook iOS SDK v3.9. (27 Oct 2013)
本质上,FBRequestConnection公开了一个urlRequest(NSMutableURLRequest)属性,您可以使用该属性向其他任何第三方联网框架甚至Apple提供的框架发送数据.
Essentially, FBRequestConnection exposes a property urlRequest (NSMutableURLRequest) that you can use to send out the data any other third party networking frameworks or even the ones Apple provided.
https://developers.facebook.com/docs/reference/ios/current /class/FBRequestConnection#urlRequest
这是一个示例,说明如何使用AFNetworking 1.x获取进度回调.
Here's an example how I get progress callbacks using AFNetworking 1.x.
NSDictionary *parameters = @{ @"video.mov": videoData,
@"title": @"Upload Title",
@"description": @"Upload Description" };
FBRequest *request = [FBRequest requestWithGraphPath:@"me/videos"
parameters:parameters
HTTPMethod:@"POST"];
FBRequestConnection *requestConnection = [request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
}];
[requestConnection cancel];
NSMutableURLRequest *urlRequest = requestConnection.urlRequest;
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
// Do your success callback.
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
// Do your failure callback.
}];
[operation setUploadProgressBlock:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {
NSLog(@"Sent %lld of %lld bytes", totalBytesWritten, totalBytesExpectedToWrite);
}];
[[APIClient sharedInstance] enqueueHTTPRequestOperation:operation];
// APIClient is a singleton class for AFHTTPClient subclass