I have integrated Pinterest in my application. Pinterest app is retrieving image (from url which I have shared) in popup but its not retrieving description text when Pinterest button is clicked in application. And it is forcing to enter description manually. I want description to be retrieved from application.
[_pinterest createPinWithImageURL:[NSURL URLWithString:#"http://placekitten.com/500/400"]
sourceURL:[NSURL URLWithString:#"http://placekitten.com"]
description:#"Pinning from Pin It Demo"];
This works for me.
_pinterest = [[Pinterest alloc] initWithClientId:#"1234567" urlSchemeSuffix:#"prod"];
[_pinterest createPinWithImageURL:[NSURL URLWithString:#"http://cs303404.vk.me/v303404440/1ae3/ZkKQLEFGeyY.jpg"]
sourceURL:[NSURL URLWithString:#"http://placekitten.com"]
description:#"Pinning Test from My Own App - Renish Dadhnaiya"];
Related
Prior to using Facebook SDK we used to share via UIActivityViewController since Facebook does not allow for us to pre-fill information on the user sharing, our solution was to use information the user description of the Image being share UIPasteboard.general.string. So the app would switch to the messenger and the user could paste. This worked just fine until we started using the Facebook SDK.
Now it seems that the UIPasteboard.general.string is reset when it opens up messenger and we no longer can get the image description copied to the clipboard.
This is how I'm sharing to messenger:
let sharePhoto = FBSDKSharePhoto()
sharePhoto.image = image
let content = FBSDKSharePhotoContent()
content.photos = [sharePhoto]
FBSDKMessageDialog.show(with: content, delegate: delegate)
Yes, I'm stacked on that staff too after FB lib update. As for me - I figured out with web link on image like it shown below. As a result - you do not need ask user to paste something. You can do it by yourself and paste it to title or description.
let content = LinkShareContent(url: url,
title: title,
description: description,
quote: nil,
imageURL: imageURL)
let dialog = ShareDialog(content: content)
dialog.presentingViewController = parentVC
dialog.mode = .automatic
dialog.completion = { result in
...
}
try? dialog.show()
Facebook is not support UI share both image and text. If you want to share an image and a text together, you can create a custom story from your app's settings, and share it as an open graph story. Here's the documentation.
I am using FBSDKShareDialog to share content from my iOS App but it doesn't attractive like content shared with PHP side.
Below is my code for FBSDKShareDialog to share content over facebook.
let shareLinkContent:FBSDKShareLinkContent = FBSDKShareLinkContent()
shareLinkContent.contentURL = NSURL(string: "http://www.google.com")
shareLinkContent.imageURL = strImageUrl
shareLinkContent.contentTitle = strName
shareLinkContent.contentDescription = "Ik heb ‘\(strName)’ beoordeeld en gaf deze whisky '\(strPercentage)' punten"
FBSDKShareDialog.showFromViewController(self, withContent: shareLinkContent, delegate: self)
Check image below to see difference between content shared using my iOS App and PHP site.
1. Post from iOS App.
1. Post from PHP Site.
Please tell me solution for this so I can post content to Facebook like PHP site.
I just want to share content like Second Image i.e content shared from PHP site.
I have created a custom open graph object, action and story on Facebook developer website, then followed the tutorial to be able to post it through the official FB app (without login in the app). This is the code:
NSMutableDictionary<FBGraphObject> *object;
NSString *returnUrl = [NSString stringWithFormat:#"http://tettomante.it/questions?%#",
[NSString stringWithURLParams:#{#"answer": _answerLabel.text, #"divination": [self divinationNickname]}]];
object = [FBGraphObject openGraphObjectForPostWithType:#"boobs-teller:question"
title:_questionTextView.text
image:#"https://d1rdorpdffwq56.cloudfront.net/icona_tettomante.jpg"
url:returnUrl
description:_answerLabel.text];
NSMutableDictionary<FBOpenGraphAction> *action = (NSMutableDictionary<FBOpenGraphAction> *) [FBGraphObject openGraphActionForPost];
action[#"question"] = object;
// Check if the Facebook app is installed and we can present the share dialog
FBOpenGraphActionShareDialogParams *params = [[FBOpenGraphActionShareDialogParams alloc] init];
params.action = action;
params.actionType = #"boobs-teller:ask";
params.previewPropertyName = #"question";
// If the Facebook app is installed and we can present the share dialog
if([FBDialogs canPresentShareDialogWithOpenGraphActionParams:params]) {
// Show the share dialog
[FBDialogs presentShareDialogWithOpenGraphActionParams:params
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
// There was an error
NSLog(#"Error publishing story: %#", error.description);
}
else {
// Success
NSLog(#"result %#", results);
}
}];
}
The problem is that once in the FB app the custom story preview appears correctly and after about 10 seconds disappears, while the "Publish" button on the top is disabled (greyed out) and doesn't enable itself. I don't understand what's going on. I thought that could be because the app was in sandbox mode (I was using the administrator user so that shouldn't have mattered), so I made it public but nothing changed. Then I thought I had to make FB review the custom action, so I had that sorted out also, but nothing has changed. Now I don't know what to try next.
I had the same issue while creating a new app. The Open Graph tags have to be exactly correct, or you won't be able to publish your story.
Check to make sure the objects and actions created in the Facebook app dashboard match what you have listed in the code.
object = [FBGraphObject openGraphObjectForPostWithType:#"boobs-teller:question"
In this line, "boobs-teller" should be what you have listed as your App's namespace(Facebook Apps > Settings > Basic), and "questions" should be the custom Object (Open Graph > Object Types) you created in the App dashboard. If you haven't created these yet, go here: https://developers.facebook.com/apps
params.actionType = #"boobs-teller:ask";
In this line, "boobs-teller" should be your app namespace, and "ask" is the custom Action (Open Graph > Action Types) you created in the app dashboard.
More details are here: https://developers.facebook.com/docs/ios/open-graph/
You can also check the sample iOS apps on GitHub, the FBOGSampleSD app helped me out a lot while learning Open Graph. https://github.com/fbsamples/ios-howtos
I have a sharekit implementation where everything works fine, but if there is no account set for facebook, upon pressing the settings button, the actionsheet is just dismissed and the user is returned to the app, not to the settings page in system prefs.
How do I get the settings button to send the user to the settings page?
the code i use to init the action sheet:
NSURL *url = [NSURL URLWithString:#"http://test"];
SHKItem *item = [SHKItem URL:url title:#"test"];
SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];
// Display the action sheet
[actionSheet showFromTabBar:self.tabBarController.tabBar];
This is a known, unresolved issue with ShareKit. You could submit a pull request to fix it, or work around it by checking SLComposeViewController:
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
// show ShareKit
} else {
// tell them to get Facebook
}
before displaying ShareKit. Of course, that would make it so users without Facebook (like Twitter-only folks) couldn't use ShareKit. On the other hand, you could switch over to Apple's Share Sheets, or write your own, but those also have their disadvantages. Kind of a catch-22.
I'm using ShareKit to share through FB and twitter. I'm using this code to share to twitter:
- (IBAction)twitterShare:(id)sender {
// Create the item to share (in this example, a url)
NSURL *url = [NSURL URLWithString:[flexViewController shareURL]];
SHKItem *item = [SHKItem URL:url title:[flexViewController shareText]];
[SHK setRootViewController:self];
// Share the item
[SHKTwitter shareItem:item];
}
I'm getting "403 Forbidden:The server understood the request but is refusing to fulfill it". This always happens if the login view was prompted. If the user was already logged in from an earlier session (the app was closed and reopened), it works correctly.
In this page, it declares that 403 means I have reached a limit, which I don't think it's my case.
https://dev.twitter.com/docs/error-codes-responses
The above code worked correctly last week, but now I'm getting this error.
Ran into the same issue using the old version of ShareKit and was able to solve by editing the Twitter URL in the following section of SHKTwitter.m.
- (void)sendStatus
{
OAMutableURLRequest *oRequest = [[OAMutableURLRequest alloc] initWithURL:[NSURL URLWithString:#"https://api.twitter.com/1/statuses/update.json"]
The URL was different in the ShareKit 2.0 version.