In one of our app, we are supposed to give an option to share newly unlocked Achievement. Requirement also includes to post defined text if share box is empty.
The problem is, we are unable to find relevant delegate method when user clicks on POST/Send button.
Code for posting status is,
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:awardToBeShareOnFB];
content.contentTitle = #"Helloworld";
content.contentDescription = #"Helloworld";
[FBSDKShareDialog showFromViewController:[self parentViewController]
withContent:content
delegate:self];
It should post "Helloworld" as a status if posting box is empty.
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 want my app to share something in Facebook with this code. When I am done sharing or cancelled sharing. Then it returns to my ViewController embedded in a NavigationController.
The Back bar button item disappears(somehow hidden) but still functions on all View Controllers. ,
I am using SWRevealViewController.
This is my code to present the FB share dialog:
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentTitle = #"K&D Running App";
content.imageURL = [NSURL URLWithString:imageUrl];
content.contentDescription = [self getStringPost];
content.contentURL = [NSURL URLWithString:webUrl];
[FBSDKShareDialog showFromViewController: self
withContent:content
delegate:nil];
I'm trying to implement deep linking in my iOS app, so far I can post to my wall but only posts that are really links that goes to google.com (obviously this is a test link). I want the user to be navigated to my app when clicking on the post through the Facebook app, please I need a step by step guide cause Facebook documentation about its a little bit complicated. Here's my code:
- (void)shareOnFacebookWithName:(NSString *)contentTitle withDescription:(NSString *)contentDescription withLink:(NSString *)contentURL withPictureLink:(NSString *)imageURL andViewController:(UIViewController*)viewController{
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:contentURL];
content.contentTitle = contentTitle;
content.imageURL = [NSURL URLWithString:imageURL];
content.contentDescription = contentDescription;
[FBSDKShareDialog showFromViewController:viewController
withContent:content
delegate:self];
}
my app has mobile only content. It uses hosted urls to refer to the content (http://fb.me/CANONICAL_ID) that only opens in app. like the ones shown on (https://developers.facebook.com/docs/applinks/hosting-api). After fetching the canonical url from my server. The facebook dialog box is suppose to share it like so:
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
[content setContentURL:[NSURL URLWithString:canonical_urlString]];
[content setContentTitle:appName]; //ignored??
[content setImageURL:[NSURL URLWithString:thumbnailUrlString]];//ignored??
[content setContentDescription:caption];//ignored??
[FBSDKShareDialog showFromViewController:self
withContent:content
delegate:nil];
when i share, the post only has the fb.me link and it ignores the thumbnail assigned above, the title and the description.
Why can`t i share the link with the content attributes assigned?
Any suggestion will help.
I'm creating the FBSDKShareLinkContent object and feeding it into the FBSDKShareDialog. I'm trying to set up the dialog's default message to something like "my highscore is %d !". sharing itself is working and has an empty message by default. can anyone help please?
thank you!
EDIT: here is my piece of code:
FBSDKShareLinkContent* content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString: #"https://itunes.apple.com/us/app/cylinder-game"];
content.contentTitle = #"Cylinder Game";
content.contentDescription = #"Cylinder Game is endless, rhythm based game with super addictive gameplay";
FBSDKShareDialog* dialog = [[FBSDKShareDialog alloc] init];
[dialog setMode:FBSDKShareDialogModeAutomatic];
[dialog setShareContent:content];
[dialog setDelegate:self];
[dialog setFromViewController:UnityGetGLViewController()];
There's no way to set the default message using the share dialog offered by the SDK. It's also considered prefilling, and is against the Facebook Platform Policy, see section 2.3 https://developers.facebook.com/policy
I found that the title and description is related to url object anyway. That means the text of message above the object, which user see in share dialog cannot be affected it seems.
And the title and descripton of URL object only works if you set the dialog mode to Native or FBSDKShareDialogModeFeedBrowser.
dialog.mode = FBSDKShareDialogModeNative;
if (![dialog canShow]) {
dialog.mode = FBSDKShareDialogModeFeedBrowser;
}
Another thing is, there is some property of FBSDKShareLinkContent called "quote", which displays some text above URL object and under message itself, but it is not displayed in all modes. For example not in Native, but yes in FBSDKShareDialogModeFeedBrowser.
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:#"http://www.x.com"];
content.contentDescription = #"desc";
content.contentTitle = #"title";
content.quote = #"quote";