Note that there are some explanatory texts on larger screens.

plurals
  1. POFacebook Batch Photo Upload iOS
    primarykey
    data
    text
    <p>I am having some trouble trying to get the Facebook iOS SDK to batch upload photos. Currently I can upload them one by one, but I would like to batch the requests if possible. I have read this <a href="https://stackoverflow.com/questions/5353117/facebook-connect-batch-requests-and-fql-error-problem">post over and over</a> along with the <a href="https://developers.facebook.com/docs/reference/api/batch/" rel="nofollow noreferrer">fb batch docs</a>. Here is what I have thus far.</p> <pre><code> 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]; </code></pre> <p>I am mapping the imageData to the key it is looking for, but I get this response every time.</p> <pre><code> { 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"; } ); } ) </code></pre> <p>Any help is very much appreciated. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload