I had done following code with reference to following link to create batch request for uploading multiple photos in Facebook.
I had got some solution for uploading multiple photos on Facebook through this Facebook graph API.
CODE:
NSString *jsonRequest1 = @"{ \"method\": \"POST\", \"relative_url\": \"me/photos\" , \"body\": \"Hello 1\", \"attached_files\": \"file1\" }"; NSString *jsonRequest2 = @"{ \"method\": \"POST\", \"relative_url\": \"me/photos\" , \"body\": \"Hello 2\", \"attached_files\": \"file2\" }"; NSString *jsonRequestsArray = [NSString stringWithFormat:@"[ %@, %@ ]", jsonRequest1, jsonRequest2]; NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:jsonRequestsArray,@"batch",nil]; [params setObject:UIImagePNGRepresentation(self.image1) forKey:@"file1"]; [params setObject:UIImagePNGRepresentation(self.image2) forKey:@"file2"]; [objFacebook requestWithGraphPath:@"me" andParams:params andHttpMethod:@"POST" andDelegate:self];
Now when I am running this code I got the following output.
Result Dictionary in - (void)request:(FBRequest *)request didLoad:(id)result
( { body = "{\"error\":0,\"error_description\":\"File file1 has not been attached\"}"; code = 400; headers = ( { name = "HTTP/1.1"; value = "400 Bad Request"; }, { name = "Content-Type"; value = "text/javascript; charset=UTF-8"; } ); }, { body = "{\"error\":0,\"error_description\":\"File file2 has not been attached\"}"; code = 400; headers = ( { name = "HTTP/1.1"; value = "400 Bad Request"; }, { name = "Content-Type"; value = "text/javascript; charset=UTF-8"; } ); } )
I don't know how this files attached.. Can anyone help me to figure out this problem.
Is there any change in my code then please let me know.
Thanks in advance...
Select Photo/Video Album at the top of the update box. Navigate through your computer's drive and select images you want to post. To select multiple images, hold down the Shift or Command key on a Mac, or the Ctrl key on a PC, while you select multiple images to post to the album. Each image should be highlighted.
Open Facebook and click the "+" to create a new story. Then, you should see the photo gallery, click on the Select Multiple button. Choose the photos you want to post one by one and click "Next". Then, you can preview your photos and edit each photo freely.
Share Up to 10 Photos and Videos in One Ad or Post.
Note: You can upload up to 1000 photos to an album.
I recommend you use the new integrated Facebook API's in iOS 6 to do this instead of Facebook's API: https://developer.apple.com/videos/wwdc/2012/?id=306 there's a golden WWDC video for all social tasks. Plus using the new API's in iOS 6 is MUCH faster then using Facebooks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With