我需要允许用户在iOS应用上发布Facebook信息,以下几乎是我想要的,但是:
任何人都可以提出我应该使用的其他架构,如果没有,可以使用#books; book.book'这将正确表达意义:"用户A读取(或喜欢)用户B"的帖子。
现在FB的帖子看起来如何:
我正在使用的代码如下:
NSString *title = self.currSelecectedContextCell.uploaderDemoLabel.text;
NSURL *imageURL = self.currSelecectedContextCell.upload.screenshotURL;
NSString *description = self.currSelecectedContextCell.contextLabel.text;
NSDictionary *properties = @{
@"og:type": @"books.book",
@"og:title": title,
@"og:image": imageURL,
@"og:description": description,
@"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"];
FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
content.action = action;
content.previewPropertyName = @"books:book";
[FBSDKShareDialog showFromViewController:self
withContent:content
delegate:nil];
答案 0 :(得分:2)
以下列方式解决:
NSString *title = self.currSelecectedContextCell.uploaderDemoLabel.text;
NSURL *imageURL = self.currSelecectedContextCell.upload.screenshotURL;
NSString *description = self.currSelecectedContextCell.contextLabel.text;
NSDictionary *properties = @{
@"og:type": @"object",
@"og:url":@"http://www.textpertapp.co/",
@"og:title": title,
@"og:image": imageURL,
@"og:description": description
};
FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:properties];
// Create an action
FBSDKShareOpenGraphAction *action = [[FBSDKShareOpenGraphAction alloc] init];
action.actionType = @"og.likes";
[action setObject:object forKey:@"object"];
FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
content.action = action;
content.previewPropertyName = @"object";
[FBSDKShareDialog showFromViewController:self
withContent:content
delegate:nil];