今、私は複数のメソッドを送信するためにバッチメソッドを使用しようとしているので、FBGraphを使用してFacebookで2つの画像を送信しようとするために次のコードを使用しました。
NSString *req01 = @"{ \"method\": \"POST\", \"relative_url\": \"me/photos\", \"body\": \"message=MyMessageOnPhotoone\", \"attached_files\": \"myimagedata\"}";
NSString *req02 = @"{ \"method\": \"POST\", \"relative_url\": \"me/photos\", \"body\": \"message=MyMessageOnPhototwo\", \"attached_files\": \"myimagedata\"}";
NSString *allRequests = [NSString stringWithFormat:@"[ %@, %@ ]", req01, req02];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObject:allRequests forKey:@"batch"];
[facebook requestWithGraphPath:@"me" andParams:params andHttpMethod:@"POST" andDelegate:self];
そしてバッチ方式は、
curl
–F 'access_token=…' \
-F 'batch=[{"method":"POST", \
"relative_url":"me/photos", \
"body":"message=My cat photo" \
"attached_files":"file1" \
},
{"method":"POST", \
"relative_url":"me/photos", \
"body":"message=My dog photo" \
"attached_files":"file2" \
},
]’
-F 'file1=@cat.gif' \
-F 'file2=@dog.jpg' \
https://graph.facebook.com
次のエラーが発生しました、
(
{
my binary image encoded data
code = 400;
headers = (
{
name = "WWW-Authenticate";
my binary image encoded data
},
{
name = "HTTP/1.1";
value = "400 Bad Request";
},
{
name = "Cache-Control";
value = "no-store";
},
{
name = "Content-Type";
value = "text/javascript; charset=UTF-8";
}
);
},
{
myimage binary encoded data
code = 400;
headers = (
{
name = "WWW-Authenticate";
myimageBinary encoded data
},
{
name = "HTTP/1.1";
value = "400 Bad Request";
},
{
name = "Cache-Control";
value = "no-store";
},
{
name = "Content-Type";
value = "text/javascript; charset=UTF-8";
}
);
}
)
コードのURLリクエストに問題があるのを修正できません。