How to upload multiple photos to Facebook from wit

2020-02-26 03:40发布

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条回答
在下西门庆
2楼-- · 2020-02-26 04:06

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.

查看更多
登录 后发表回答