Tôi đang gặp một số sự cố khi cố gắng tải SDK iOS của Facebook lên hàng loạt ảnh tải lên. Hiện tại tôi có thể tải lên từng cái một, nhưng tôi muốn gửi hàng loạt các yêu cầu nếu có thể. Tôi đã đọc số post over and over này cùng với fb batch docs. Đây là những gì tôi có cho đến nay.Tải lên hàng loạt Facebook Ảnh iOS
Facebook *facebook = [(AppDelegate*)[[UIApplication sharedApplication] delegate] facebook];
NSData *imageData = UIImagePNGRepresentation([imgs objectAtIndex:0]);
NSString *jsonRequest1 = [NSString stringWithFormat:@"{ \"method\": \"POST\", \"relative_url\": \"me/photos\", \"attached_files\": \"file1\" }"];
NSString *jsonRequest2 = [NSString stringWithFormat:@"{ \"method\": \"POST\", \"relative_url\": \"me/photos\", \"attached_files\": \"file2\" }"];
NSString *jsonRequestsArray = [NSString stringWithFormat:@"[ %@, %@ ]", jsonRequest1, jsonRequest2];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:jsonRequestsArray,@"batch",imageData,@"file1",imageData,@"file2" nil];
Tôi ánh xạ imageData vào khóa mà nó đang tìm kiếm, nhưng tôi nhận được phản hồi này mọi lúc.
{
body = "{\"error\":{\"message\":\"File batch has not been attached\",\"type\":\"GraphBatchException\"}}";
code = 400;
headers = (
{
name = "WWW-Authenticate";
value = "OAuth \"Facebook Platform\" \"invalid_request\" \"File batch has not been attached\"";
},
{
name = "HTTP/1.1";
value = "400 Bad Request";
},
{
name = "Cache-Control";
value = "no-store";
},
{
name = "Content-Type";
value = "text/javascript; charset=UTF-8";
}
);
},
{
body = "{\"error\":{\"message\":\"File file2 has not been attached\",\"type\":\"GraphBatchException\"}}";
code = 400;
headers = (
{
name = "WWW-Authenticate";
value = "OAuth \"Facebook Platform\" \"invalid_request\" \"File file2 has not been attached\"";
},
{
name = "HTTP/1.1";
value = "400 Bad Request";
},
{
name = "Cache-Control";
value = "no-store";
},
{
name = "Content-Type";
value = "text/javascript; charset=UTF-8";
}
);
}
)
Bất kỳ sự giúp đỡ rất nhiều đánh giá cao.
mỗi hình ảnh được chia sẻ như bài riêng biệt. có thể chia sẻ dưới dạng một bài đăng với nhiều hình ảnh không? – venky