iphone – 使用批处理请求在Facebook上上传多张照片

iphone – 使用批处理请求在Facebook上上传多张照片,第1张

概述我做了下面的代码,参考以下 link创建批量请求上传多张照片在Facebook。 我有一些解决方案,上传多张照片在Facebook通过这个Facebook graph API. 码: NSString *jsonRequest1 = @"{ \"method\": \"POST\", \"relative_url\": \"me/photos\" , \"body\": \"Hello 1\", 我做了下面的代码,参考以下 link创建批量请求上传多张照片在Facebook。

我有一些解决方案,上传多张照片在Facebook通过这个Facebook graph API.

码:

Nsstring *JsonRequest1 = @"{ \"method\": \"POST\",\"relative_url\": \"me/photos\",\"body\": \"Hello 1\",\"attached_files\": \"file1\" }";    Nsstring *JsonRequest2 = @"{ \"method\": \"POST\",\"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];

现在当我运行这个代码,我得到以下输出。

结果字典在 – (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";            }        );    })

我不知道这个文件如何附加..任何人都可以帮助我找出这个问题。

我的代码有任何变化,那么请让我知道。

提前致谢…

解决方法 我建议你使用新的集成的Facebook API在iOS 6这样做而不是Facebook的API: https://developer.apple.com/videos/wwdc/2012/?id=306有一个黄金WWDC视频所有的社会任务。加上在iOS 6中使用新的API大大快于使用Facebook。 总结

以上是内存溢出为你收集整理的iphone – 使用批处理请求在Facebook上上传多张照片全部内容,希望文章能够帮你解决iphone – 使用批处理请求在Facebook上上传多张照片所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1087426.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-27
下一篇2022-05-27

发表评论

登录后才能评论

评论列表(0条)

    保存