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.