2

I have shared some content to Facebook and I am using this POC for that.

NSString *title = @"Some Title";
NSString *shareBody =[NSString stringWithFormat:@"%@\nI have rated %@ as %zd/5", self.commentTextView.text, store.name, self.rating];

NSString *storeID = store.ID.description;

FBSDKShareLinkContent *content = [FBSDKShareLinkContent new];
content.contentTitle = title;
content.contentDescription = shareBody;
content.imageURL = [NSURL URLWithString:store.coverImage.medium];
content.placeID = storeID;
content.contentURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://fb.me/ 137144****85103?store=%@", store.ID]];

FBSDKShareDialog* dialog = [FBSDKShareDialog new];
dialog.delegate = self;
dialog.shareContent = content;
dialog.mode = FBSDKShareDialogModeBrowser;
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fbauth2://"]])
    dialog.mode = FBSDKShareDialogModeAutomatic;
dialog.fromViewController = [UIApplication sharedApplication].keyWindow.rootViewController;

Post is successfully shared to Facebook even if Facebook app is installed or not.

The first case is when I am using Facebook app and i click on the shared post, it opens my application(if it is installed) or takes me to iTunes URL.

The second case is Facebook app is not installed on my phone and I use safari to view Facebook and I click on that post. It tries to open the url but redirect me to facebook.com again.

The third case is Facebook app is installed on my phone but still I use safari to view Facebook and I click on that post, it opens facebook app instead of my app.

I need help for Case 2 and 3. Please advise ?

kashifasif
  • 172
  • 11

0 Answers0