如何从iPhone应用程序中将多张照片上传到Facebook? [英] How to upload multiple photos to Facebook from within iPhone app?

查看:146
本文介绍了如何从iPhone应用程序中将多张照片上传到Facebook?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有API调用,我们可以用来从iPhone应用程序将多张照片上传到Facebook?到目前为止,我们一次只能做一次。

解决方案

您将需要直接使用Facebook Connect API:iOS SDK不会公开此类功能。 >

你应该看看 Graph Photo API ,它建议此URL上传图像(不要忘记请求 publish_stream 凭据):

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

message = [
source = [图像数据]
place = [可选图像的位置]

随着iOS Facebook Connect SDK给我们这个电话,给你一个 Facebook 实例叫 facebook UIImage 实例调用图像

  [facebook requestWithMethodName:@/ USER_ID / photos 
andParams:[NSDictionary dictionaryWithObjectsAndKeys:
UIImageJPEGRepresentation(image,0.7),@source,
@我的小狗太可爱了!!!,@message,
nil]
和HttpMethod:@POST
andDelegate:self];

您可以将此电话与批次请求同时上传多张照片。


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.

解决方案

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.

这篇关于如何从iPhone应用程序中将多张照片上传到Facebook?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆