2

我有以下代码来添加一个事件,一切正常并加载到 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];
4

2 回答 2

2

好的,如果您正在使用当前的 Facebook API for IOS,我发现了这一点,那么您可以将 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];
于 2012-07-27T17:04:23.120 回答
0

请在此处查看 facebook 开发者的文档https://developers.facebook.com/docs/reference/api/event/。您可以在其中找到包含图像的参数“图片”

于 2012-07-18T04:49:35.470 回答