I am making a online shopping based App. I want to create a functionality to post my product details in Facebook. Can anyone tell me how I can achieve this?
I want to share product details automatically in fb when the user press share button.
I think you already have your product image and the detail information about it. So Facebook provides an SKD where you can share your product information from just one click of button. And also u can make users to redirect to your link when the users click on your post.
for more information about FBSDKShareKit please go through this FB for developers link
Here is the code for sharing your product info and sending users to your page when they click on it,
just write this code in your method of share button.
FBSDKShareLinkContent *content =[[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:@"your product page URL here"];
content.imageURL = [NSURL URLWithString:@"your product image url here"];
content.contentTitle= @"Title of your product";
content.contentDescription=@"Description of your product";
FBSDKShareDialog *dialog=[[FBSDKShareDialog alloc]init];
dialog.mode=FBSDKShareDialogModeNative;
if (![dialog canShow]) {
// fallback presentation when there is no FB app
dialog.mode = FBSDKShareDialogModeWeb;
//
}
dialog.shareContent=content;
dialog.delegate=self;
dialog.fromViewController=self;
[dialog show];
make sure you import FBSDKCoreKit/FBSDKCoreKit.h and FBSDKShareKit/FBSDKShareKit.h in your .h file and add the delegates to it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With