Facebook Sharer for iOS - ios

I searched about Facebook Like/Recommand/Share function for iOS for many many days. Today I finally come here to find what I need. So I doubt How to do this? For Facebook Developers Website's documents are not detail, especially on iOS. So I am asking questions here. Thank you very much.
The image is here.

Facebook has an iOS SDK - check here and here. Maybe this could help you...
You could also provide backend support for FB likes etc. using oAuth Flow. For that you could use Python, PHP or any other popular language to interface with FB Graph API

Maybe you wanna try BMSocialShare.

I try new facebook sharer dialog. You can find that here
But first of all, you must open a facebook app. I set facebook app type to mobil internet instead of ios.
Secondly you can use this code for sharing :
NSURL *shareURL = [NSURL URLWithString:#"https://www.facebook.com/dialog/feed?
app_id=458358780877780&
link=https://developers.facebook.com/docs/reference/dialogs/&
picture=http://fbrell.com/f8.jpg&
name=Facebook%20Dialogs&
caption=Reference%20Documentation&
description=Using%20Dialogs%20to%20interact%20with%20users.&
redirect_uri=http://www.facebook.com/"]
[[UIApplication sharedApplication] openURL: shareURL];
You have to change your app_id within this shareURL.
Lastly; i give same redirect uri for both facebook api and direct url.

Related

Link to open up iOS app from facebook and twitter page and other ios app?

Hi I have a requirement in my app. From my ios Application(myapp),i share a link to facebook. Then I opened up my facebook account in browser or Facebook application and clicked the link, link should open in myapp if myapp is installed in the device otherwise link should open in browser. How can I achieve this ? Please suggest me step by step. Thanks in advance for your consideration and help.
I am not sure if this is possible. I have looked at various questions including
Is it possible to register a http+domain-based URL Scheme for iPhone apps, like YouTube and Maps?
as I am sure you might have already done but these questions target their own app, mainly web app, but you want that behavior to occur from an app that is not yours like twitter or facebook. But what you can do is show them two links on facebook/twitter, if they have installed press link 1 and if they want to install, press link 2 and you can pass parameters in link 1 as you might already know.
I will also keep checking answer of this question if some one comes and gives a better solution.
There is an option called custom URL scheme in iOS. It will help you to create a URL scheme which identifies your application. You can post link with this URL scheme and when you tap on this link on your iOS device it will open up your mobile app. Please see the link below to know how to setup this.
Custom URL Scheme in iOS
This is called 'deep URL linking'. Facebook have built a service called 'App Links', which seems pretty cool.
https://developers.facebook.com/docs/ios/app-links

Fetch images from Instagram in iOS

I wish to fetch images from Instagram into iOS app. For this I am using Instagram API. I have set clientID and redirect-uri as shown in http://kmdarshan.wordpress.com/2013/02/23/integrating-instagram-sdk-in-your-ios-apps/ and http://instagram.com/developer/
Code used is given in link above. But in the line:
if ([[UrlParts objectAtIndex:(1)] isEqualToString:#"NeverGonnaFindMe"]) {...
the string always equals to oauth.
Where am I getting wrong? Anyone having any other option to integrate instagram images into iOS apps, please let me know.
I just found a project to fetch instagram images into ios app on:
https://github.com/hsandhu/HSInstagram
Awesome application, saved my time.
you can try this framework to show the instagram feed, both user and tags
https://www.cocoacontrols.com/controls/sbinstagram-viewer
is more complete and is easy to integrate
regards

URL shemes for apps

I wanted to open Facebook and Twitter apps from my app. I find very simple way like:
NSURL *url = [NSURL URLWithString:#"fb://profile"];
[[UIApplication sharedApplication] openURL:url];
And there are many others url for open different page of Facebook. How can I check if Facebook app exist on iPhone? What happens if the application is not install on device? Now I try to use this method on iOS Simulator but nothing happened. It's bug of iOS Simulator? Only tomorrow I will have chance to check on device.
You can check if a URL would likely open ahead of time using the canOpenURL method of UIApplication.
http://developer.apple.com/library/ios/DOCUMENTATION/UIKit/Reference/UIApplication_Class/Reference/Reference.html#//apple_ref/occ/instm/UIApplication/canOpenURL:
Also! You can pass values for the facebook page you'd like. This Stack Overflow includes a link to a wiki with all the variations:
Launching Facebook and Twitter application from other iOS app
If you know the URL scheme that the other app is using (e.g. fb:// for the Facebook app), you can first ask whether your UIApplication object can open such URLs in the first place, with canOpenURL:. You can use this, for instance, to decide whether to display a link at all, or whether to direct the user to Safari (with a normal web URL) instead.
As third-party apps cannot be installed on the Simulator as far as I know, the only way to test compatibility with them is on an actual device.

Opening a facebook URL on iOS with openURL leads to broken page on Facebook app

When I open a facebook url using 'openURL', in the form of "http://www.facebook.com/SomePage", it gets opened by the Facebook app, and it leads to a broken page (most of the screen is blank), or to the user's "timeline" (depending on the device and version of the app). Is there any way to force the URL to go to Safari? I don't mind that the facebook app takes over the URL, but if it doesn't know how to handle it, I'd rather have Safari do it.
As pj4533 suggested, removing the 'www.' from the front of the url fixes the issue. Adding this as an answer so it can be marked as answer and more obvious for others.
There is a bug/feature with the latest facebook app, when you use the url with shortname it instead opens the last page or the news feed of the user. You need to use the user/group id.
You can find it using the graph API https://graph.facebook.com/SHORT_NAME under the propertie "id"
example :
https://www.facebook.com/stackoverflowpage
https://www.facebook.com/11239244970
just paste page URL here http://findmyfacebookid.com/ and you will get ID for page.
Please let me know does this work for you, because it is working fine for me...
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: #"http://www.facebook.com/"]];

Creating share buttons in iOS app ( twitter facebook...)

I was wondering what is a good way to create share buttons in iOS, and by share buttons I mean these 3 kinds of buttons:
1- Follow me on Twitter
2- Like a page on Facebook
3- Send a mail (Optional)
I have heard about sharekit but I am interested in just creating these 3 buttons that will be found on the back of the page of the app.
You can use something like:
NSString *launchUrl = #"http://twitter.com/intent/user?screen_name=USER NAME";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: launchUrl]];
which will open Mobile Safari and let you follow that user. You may be required to log in.
I guess there is a similar URL for Facebook.
To send a mail from within your app, use the MessageUI Framework.
Posting data to social services is much more complicated than just setting up a button. You must register your application, choose user, authenticate, then communicate via the internet.
ShareKit does most of that for you.
You may not just 'create share button' and have it share data to fb or twitter.
Posting to those service is complicated because you'll have to create Apps on those social networks as well as handle the oauth handshake the occurs which allows your app to share on behalf of the user. The Socialize SDK (www.getsocialize.com) is the fastest way to get Facebook/Twitter authentication without coding it yourself. Sample code below:
Socialize* socialize = [[Socialize alloc] initWithDelegate:self];
[self.socialize createShareForEntityWithKey:#"http://www.url.com" medium:SocializeShareMediumFacebook text:#"Check this out!"];
You could use ShareKit 2.0
https://github.com/ShareKit/ShareKit
I believe it supports sharing on most common social networks.

Resources