【发布时间】:2016-05-16 17:41:17
【问题描述】:
我正在尝试在 Facebook 开放图表故事中发布本地照片,但未显示该图像。
此代码与 Facebook 开发人员的文档页面相同。 facebook_developers open graph ios
FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
photo.image = [UIImage imageNamed:@"coffee-and-sunrise.jpg"];
// Optionally set user generated to YES only if this image was created by the user
// You must get approval for this capability in your app's Open Graph configuration
// photo.userGenerated = YES;
// Create an object
NSDictionary *properties = @{
@"og:type": @"books.book",
@"og:title": @"A Game of Thrones",
@"og:description": @"In the frozen wastes to the north of Winterfell, sinister and supernatural forces are mustering.",
@"books:isbn": @"0-553-57340-3",
};
FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:properties];
// Create an action
FBSDKShareOpenGraphAction *action = [[FBSDKShareOpenGraphAction alloc] init];
action.actionType = @"books.reads";
[action setObject:object forKey:@"books:book"];
// Add the photo to the action. Actions
// can take an array of images.
[action setArray:@[photo] forKey:@"image"];
// Create the content
FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
content.action = action;
content.previewPropertyName = @"books:book";
[FBSDKShareDialog showFromViewController:self
withContent:content
delegate:nil];
【问题讨论】:
标签: ios objective-c facebook uiimage facebook-opengraph