Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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"];
- // Create the content
- FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
- content.action = action;
- content.previewPropertyName = @"books:book";
- FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init];
- if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fbauth2://"]]){
- dialog.mode = FBSDKShareDialogModeNative;
- }
- else {
- dialog.mode = FBSDKShareDialogModeBrowser; //or FBSDKShareDialogModeAutomatic
- }
- dialog.shareContent = content;
- dialog.delegate = self;
- dialog.fromViewController = self;
- [dialog show];
- FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
- content.contentURL = [NSURL URLWithString:@"https://developers.facebook.com"];
- content.contentTitle=@"TestSHare";
- FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init];
- if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fbauth2://"]]){
- dialog.mode = FBSDKShareDialogModeNative;
- }
- else {
- dialog.mode = FBSDKShareDialogModeBrowser; //or FBSDKShareDialogModeAutomatic
- }
- dialog.shareContent = content;
- dialog.delegate = self;
- dialog.fromViewController = self;
- [dialog show];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement