Sharing my message with share kit to twitter - ios

i imported sharekit library in my project and i write following codes
SHKItem *item = [SHKItem text:#"sample message"];
SHKTwitter* twt = [[SHKTwitter alloc] init];
[twt setItem:item];
[twt share];
or
SHKItem *item = [SHKItem text:#"sample message"];
[SHKTwitter shareItem:item];
as you know, first authentication window appears. i want to share text when i enter my user name and password. but it redirect my redirect url and window don't close automatically

Related

Facebook post do not open my application when i try from safari even though it works when using facebook application.

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 ?

How to share a post to a facebook group, not my own timeline, using the Facebook SDK share dialog?

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];

Facebook Open Graph Story- caption and app link with user generated photo

I am trying to publish an open graph story containing an App Link.
I set up my story with the following code-
NSDictionary *properties = #{
#"og:type": #"bcskitracker:tour",
#"og:title": tour.route.name,
#"og:distance": [tour.distance stringValue],
#"og:vertical": [tour.ascent stringValue],
#"og:description": #"description",
#"og:url": #"https://fb.me/786890254772699",
#"og:image": photo
};
FBSDKShareOpenGraphObject *tourObject = [FBSDKShareOpenGraphObject objectWithProperties:properties];
FBSDKShareOpenGraphAction *action = [[FBSDKShareOpenGraphAction alloc] init];
action.actionType = #"bcskitracker:ski";
[action setObject:tourObject forKey:#"bcskitracker:tour"];
[action setString:#"true" forKey:#"fb:explicitly_shared"];
FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
content.action = action;
content.previewPropertyName = #"bcskitracker:tour";
[FBSDKShareAPI shareWithContent:content delegate:self];
If the photo is marked as userGenerated:NO, the story is published as expected with a caption and if you tap the post it opens the iPhone app:
However only one photo can be displayed and appears very small on the iPhone. If I mark the photo as userGenerated:YES the post displays the large photo, however there is no caption and no app link (only a link to facebook's app directory)-
The post doesn't even display the tour title as constructed in the story template-
Is there any way to include the caption and app link with a user generated photo? I understand I can set the action.message but this is restricted and doesn't link to the app.
This is currently intended behaviour; if you set a photo attachment as user_generated = yes, it's considered as a photo upload. In that case, you can't mix in Open Graph information. So it's one of the two :)
What you could do, is to generate a single image on your server side with both the map and uploaded photo. If you use that as your og:image, it will be included in the post.

How make image sharing to Facebook with link back to content page in website/app like Instagram?

I am building an iOS app that let user created some type of images and when user finished doing that they can choose to publish it on their facebook timeline automatically.
I am able to post to user's timeline automatically because user allow publish_permission to our app. And I let my app post an image created by users to their facebook timeline. It went out smoothly. The image appear on Facebook and it displayed that this image is created by my app. But I am not able to provide the link when users click on the name of app to my content page. How can I do that ? I saw Instagram having this feature and it should drive more engagement to our app. This is the screenshot of how Instagram does this
This is how my app display it
This is the code how I posted image to user's timeline in my iOS app
FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
photo.image = [UIImage imageWithData:,myImage];
photo.userGenerated = YES;
NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:#"http://www.myWebsite.com/profile/%#/item/xxxx]];
photo.caption = [NSString stringWithFormat:#"%#%# Created by xxx"];
photo.userGenerated = YES;
photo.imageURL = URL;
FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];
content.photos = #[photo];
[FBSDKShareAPI shareWithContent:content delegate:self];
Do I need to use opengraph or anything else ? Please help.
Thanks in advance

How to share to Facebook (iOS)

I'm trying to share a photo to Facebook using the Open Graph API. I was unsure of how to share a photo so I'm starting off with code to just post a like. So far I have the following code:
// Create an object
NSDictionary *properties = #{
#"og:type": #"myObject",
#"og:title": #"title",
#"og:description": #"description",
};
FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:properties];
// Create an action
FBSDKShareOpenGraphAction *action = [[FBSDKShareOpenGraphAction alloc] init];
action.actionType = #"og.likes";
[action setObject:object forKey:#"myObject"];
// Create the content
FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
content.action = action;
content.previewPropertyName = #"myObject";
[FBSDKShareDialog showFromViewController:self
withContent:content
delegate:nil];
I created a custom graph object on Facebook "myObject" and am trying to share or like this publicly on Facebook. I would love any help on this, when this code runs nothing shows up. Ideally I would like to add a photo to this object and be able to share it with a callback link to either my site (and eventually the app)!
try to use shareSDK~ it's nice
link: http://www.mob.com/en
You should go to open graph on facebook app and get code sample facebook auto generate:
Dashboard
Code autogenerate

Resources