i am implementing FBShareButton in my project,but share dialog always opens WebView/Safari View instead of facebook native app.I am using facebook SDK 4.6 & xcode 7..when i use share dialog separately it opens in app, but when i use FBShareButton to open share dialog it always opens in web view..here is my code
-(void)openFacebookDialog
{
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL
URLWithString:#"https://www.facebook.com/FacebookDevelopers"];
FBSDKShareButton *shareButton = [[FBSDKShareButton alloc] init];
shareButton.shareContent = content;
shareButton.center = self.view.center;
[self.view addSubview:shareButton];
}
Related
I'm using FBSDKShareLinkContent to display a dialog to share a link to Facebook. No matter the link I use (I even tried with https://google.com/) when the post / link is tapped in the Facebook app my app is launched.
I want, however, to load the link in a web browser or the FB browser instead (and not have it launch my app or navigate to the app store). Is there anyway to achieve this? I tried both FBSDKShareDialogModeFeedWeb and FBSDKShareDialogModeAutomatic.
Here is my current code:
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:#"https://google.com/"];
FBSDKShareDialog* dialog = [[FBSDKShareDialog alloc] init];
dialog.mode = FBSDKShareDialogModeFeedWeb;
dialog.shareContent = content;
dialog.fromViewController = self;
[dialog show];
Add this to your code:
FBSDKShareLinkContent *content1 = [[FBSDKShareLinkContent alloc] init];
content1.contentURL = [NSURL URLWithString:#"http://en.wikipedia.org/wiki/Facebook"];
content1.contentTitle=#"Share";
[FBSDKShareDialog showFromViewController:self withContent:content1 delegate:nil];
I'm trying to share a link object to a Facebook group using the share dialog. No one seems to have answered this question satisfactorily yet.
The SDK documentation clearly states that you can use the share dialog to share to your own timeline or groups, yet I can't figure out how to do it. I also don't see any other apps that do it. Using the web share dialogue on a desktop you can see the option, but on a mobile website you don't! This screenshot of the iOS Facebook app shows what I'm talking about:
I'm trying to get the functionality in where it says 'tap to change' at the top.
It appears you have to use an instance of FBSDKShareDialog, and set the mode to FBSDKShareDialogModeNative.
FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init];
dialog.fromViewController = viewController;
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:#"http://www.test.com"];
content.contentTitle = productItem.productTitle;
dialog.shareContent = content;
dialog.mode = FBSDKShareDialogModeNative;
if (![dialog canShow]) {
dialog.mode = FBSDKShareDialogModeWeb;
}
dialog.delegate = self;
[dialog show];
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:APPSTORE_URL_MAIN];
content.contentTitle = INVITE_TITLE;
content.imageURL = [NSURL URLWithString:INVITE_IMG_URL];
content.contentDescription = INVITE_TEXT;
[FBSDKMessageDialog showWithContent:content delegate:self];
If the Facebook Messenger app is closed, this just opens the app and does nothing else.
Works fine is the FB Messenger app is working in background
Issue resolved by Facebook Developers.
I am using FBSDK sharebutton in my application using latest fbSDK for iOS & xcode 7,i want to share some information on friend's timeline from my app but when using FBSDK SHARE button only normal share dialog is opening with no option for sharing on friends timeline...i am using following code as per ios9 fbSDK documentation
-(void)shareOnFriendsTimeline
{
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:#"https://www.example.com"];
FBSDKShareButton *shareButton = [[FBSDKShareButton alloc] init];
shareButton.shareContent = content;
shareButton.center = self.view.center;
[self.view addSubview:shareButton];
}
please tell me where i am doing wrong...thanks in advance
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:#"http://en.wikipedia.org/wiki/Facebook"];
NSURL *imageURL =
[NSURL URLWithString:#"http://upload.wikimedia.org/wikipedia/commons/thumb/9/95/Facebook_Headquarters_Menlo_Park.jpg/2880px-Facebook_Headquarters_Menlo_Park.jpg"];
content.contentDescription=#"This is facebook test";
content.contentTitle=#"Hello";
content.imageURL=imageURL;
FBSDKShareButton *shareButton = [[FBSDKShareButton alloc] init];
shareButton.shareContent = content;
shareButton.center = self.view.center;
[self.view addSubview:shareButton];
I used facebook-ios-sdk-3.24.0.pkg and I am using the above code for link sharing on facebook using fbsdksharekit. This code is working fine but after closing the xcode and reopen that xcode6.0 it shows the below error.
FBSDKCoreKit/FBSDKCoreKit.h and FBSDKShareKit/FBSDKShareKit.h not found.
i import those frameworks i.e FBSDKCoreKit/FBSDKCoreKit.h and FBSDKShareKit/FBSDKShareKit.h to viewcontroller.m file .
can any one tell me what is the problem.Thanks in advance.
Use the Below Code to Share on Facebook, download latest Facebook SDK
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:#"http://en.wikipedia.org/wiki/Facebook"];
NSURL *imageURL =
[NSURL URLWithString:#"http://upload.wikimedia.org/wikipedia/commons/thumb/9/95/Facebook_Headquarters_Menlo_Park.jpg/2880px-Facebook_Headquarters_Menlo_Park.jpg"];
content.contentDescription=#"This is facebook test";
content.contentTitle=#"Hello";
content.imageURL=imageURL;
[FBSDKShareDialog showFromViewController:self withContent:content delegate:nil];