How to upload multiple photos to Facebook from within iPhone app?

三世轮回 提交于 2019-11-29 10:29:20

问题


Is there an API call that we can use to upload multiple photos to Facebook from iPhone app? So far we can do only one at a time.


回答1:


You will need to use the Facebook Connect API directly: the iOS SDK does not expose this kind of functionality.

You should have a look at the Publishing section of the Graph Photo API which suggests this URL to upload an image (don't forget to ask for the publish_stream credential):

POST https://graph.facebook.com/USER_ID/photos

message=[optional description]
source=[the image's data]
place=[optional image's location]

With the iOS Facebook Connect SDK that would give us this call, given you have a Facebook instance called facebook and a UIImage instance called image:

[facebook requestWithMethodName:@"/USER_ID/photos"
                      andParams:[NSDictionary dictionaryWithObjectsAndKeys:
                                 UIImageJPEGRepresentation(image, 0.7), @"source",
                                 @"My puppy is so cute!!!", @"message",
                                 nil]
                  andHttpMethod:@"POST"
                    andDelegate:self];

You can couple this call with batch requests to upload multiple pictures simultaneously.



来源:https://stackoverflow.com/questions/10197414/how-to-upload-multiple-photos-to-facebook-from-within-iphone-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!