Note that there are some explanatory texts on larger screens.

plurals
  1. POUploading multiple binary items as part of a batch call on iOS
    text
    copied!<p>I'm trying to make post with more than a photo in Fb using batch request but I keep getting timeout errors from Fb server...</p> <p>This is my code ..</p> <p>UIImage *imgFile1 = [UIImage imageNamed:@"iTGps.png"]; NSData *imageData = UIImageJPEGRepresentation(imgFile1, 0.5);</p> <pre><code>NSString *jsP1 = [NSString stringWithFormat:@"{ \"method\": \"POST\", \"relative_url\": \"me/photos\",\"body\":\"message=My cat photo\",\"attached_files\":\"%@\"}",imageData]; NSString *jsonRequestsArray = [NSString stringWithFormat:@"[%@,%@,%@]",jsP1,jsP1,jsP1]; NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObject:jsonRequestsArray forKey:@"batch"]; FBRequestConnection *connect = [[FBRequestConnection alloc] initWithTimeout:60]; // do Fb request FBRequest *request = [FBRequest requestWithGraphPath:@"me/photos" parameters:params HTTPMethod:@"POST"]; // add connection [connect addRequest:request completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { NSLog(@"Result:%@,%@",result,error); }]; [connect start]; </code></pre> <p>Where am I doing wrong??</p> <p>Error code is very long so i cut the middle part (i think is the binary images)</p> <p>2013-04-28 20:03:32.435 trueGps[1887:1a603] Result:(null),Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x14454010 {com.facebook.sdk:ErrorInnerErrorKey=Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x14492d40 {NSErrorFailingURLStringKey=<a href="https://graph.facebook.com/me/photos?sdk=ios&amp;batch=%5B%7B%20%22method%22%3A%20%22POST%22%2C%20%22relative_url%22%3A%20%22me%2Fphotos%22%2C%22body%22%3A%22message%3DMy%20cat%20photo%22%2C%22attached_files" rel="nofollow">https://graph.facebook.com/me/photos?sdk=ios&amp;batch=%5B%7B%20%22method%22%3A%20%22POST%22%2C%20%22relative_url%22%3A%20%22me%2Fphotos%22%2C%22body%22%3A%22message%3DMy%20cat%20photo%22%2C%22attached_files</a> ....</p> <p>NSLocalizedDescription=The request timed out., NSUnderlyingError=0x2a90f620 "The request timed out."}, com.facebook.sdk:HTTPStatusCode=200}</p>
 

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