Facebook iOS SDKに写真を一括アップロードする際に問題が発生しています。現在、私はそれらを一つずつアップロードすることができますが、可能であればリクエストをバッチしていきたいと思います。私はこれをfb batch docsと一緒にpost over and overと読んでいます。ここまで私がこれまで持っていたことがあります。Facebookバッチ写真アップロード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];
私はそれが探しているキーに画像データをマッピングしていますが、私はこの応答を毎回取得します。
{
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";
}
);
}
)
ご協力いただきありがとうございます。 new Facebook SDK (3.0)で
にバッチであることができる要求の数を制限することに注意してください。複数の画像で1つの投稿として共有することは可能ですか? – venky