Reputation: 4352
I need to allow users to post on Facebook info from the iOS app and the following is almost what I want to have, but:
Could anyone propose of what other schema should I use, if not 'books.book' that would express the sense correctly: "User A reads (or likes) a post of user B".
That's how the post to FB looks right now:
And the code that I am using for this is the following:
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];
Upvotes: 0
Views: 51
Reputation: 4352
Solved it in the following way:
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];
Upvotes: 2