ios - iphone - 如何在使用 Facebook IOS SDK 创建事件时添加图像

标签 ios ios5 ios4

我有以下代码来添加一个事件,一切正常并加载到 facebook,没有任何问题,唯一的问题是图像没有上传,iOS 文档中也没有任何类型的帮助,也许我正在寻找错误的地方?也许您经历过这种情况并且可以提供帮助。谢谢

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                 [delegate facebook].accessToken, @"access_token",
                                 @"Going To Eat!", @"name",
                                 @"description of the event", @"description",
                                 @"2012-08-20T17:00:00+0000", @"start_time",
                                 @"2012-08-21T17:00:00+0000", @"end_time",
                                 @"Carlsbad", @"city",
                                 @"CA", @"state",
                                 @"900 safe street", @"street",
                                 @"OPEN", @"privacy",
                                 @"https://.../img/faces/pizza-port-brewing-carlsbad.jpg", @"@file.jpg",
                                 nil];

  [[delegate facebook] requestWithGraphPath:@"me/events" 
                        andParams:params
                    andHttpMethod:@"POST"
                      andDelegate:self];

最佳答案

好吧,如果您使用当前的 iOS 版 Facebook API,那么您可以将 UIImage 对象传递给 requestWithGraphPath:调用它会自动检测它并将其上传到您的事件图标。如果它是图像链接,则从 NSURL 中创建 UIImage。

UIImage *image = [[UIImage alloc]initWithImageNamed@"test.png"];    
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                 [delegate facebook].accessToken, @"access_token",
                                 @"Going To Eat!", @"name",
                                 @"description of the event", @"description",
                                 @"2012-08-20T17:00:00+0000", @"start_time",
                                 @"2012-08-21T17:00:00+0000", @"end_time",
                                 @"Carlsbad", @"city",
                                 @"CA", @"state",
                                 @"900 safe street", @"street",
                                 @"OPEN", @"privacy",
                                 image, @"picture",
                                 nil];

  [[delegate facebook] requestWithGraphPath:@"me/events" 
                        andParams:params
                    andHttpMethod:@"POST"
                      andDelegate:self];

关于ios - iphone - 如何在使用 Facebook IOS SDK 创建事件时添加图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11534363/

相关文章:

ipad - iOS5:MPMoviePlayerController 仅视频,无音频

objective-c - NSDateComponents 问题 - 日期不正确

ios - 字符串和属性问题

javascript - map View 未加载 PhoneGap

android - OpenMp 与 IOS/Android 的兼容性

ios - 突出显示类似于 UIButton 的 UIView

ios5 - MPMoviePlayerViewController 与外观框架 (iOS 5)

iphone - 可以使用哪些编程语言来开发 iPhone、iPod Touch 和 iPad (iOS) 应用程序?

iphone - 如何在 iPhone SDK 中集成 Google Image Search API?

objective-c - 用于 objective-c 的 Twitter SDK