Open Facebook page from iOS game - ios

I'm creating a facebook game and I want to have a button which let user open my facebook page, however, when I open my page url:
https://www.facebook.com/Spiritbomb.co
It just opens the native Facebook app but does not redirect to my page.
I tried this url on Safari and it works just fine.
Anyone experienced with this could help me please?

Try using NSURL
NSUrl *aUrl = [NSURL URLWithString:#"your facebook url"];
[[UIApplication sharedApplication] openURL:url];

I found out that this type of url doesn't work
https://www.facebook.com/Spiritbomb.co
(What I mean by "doesn't work" is that open this URL in an iOS app will only launch the FB native app, but does not redirect you to the desired Page)
You need to find your Facebook Page ID and use this URL: https://www.facebook.com/YOUR_FB_PAGE_ID
In my case, this URL works: https://www.facebook.com/690543054295905
How to find your FB Page ID: Go to your FB Page, click Edit Page -> Update Page Info
Then scroll to the bottom of the page, you'll find your FB page ID there.
Thanks for all the help, guys.

Related

Open Link on Twitter App IOS

I have created a mail template on mailchimp. It consists of a twitter link. But an IPad or an IPhone user clicks on the link from his/her mail, the twitter link opens in the browser instead of the twitter app.
This does not happen in Android.
Any workarounds?
If you use a custom URL <a href="twitter://" than other Android/Desktop devices won't be able to open it. Twitter doesn't redirect with standard URLs from Safari and they should. But they do offer a "Open in app" button at the top left.
So if you want you could add two buttons in the email. One specifically for iOS: twitter://status?id=373205208664272897 and one for other devices https://twitter.com/support/status/373205208664272897.
Or you could create a site that reads the user agent of the device than determines which URL to redirect to.
The third option is just leaving it alone given that it's not really such a big issue in the grand scheme.
NSString *stringURL = #"twitter://";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
From iPhone URL Schemes.

How to send a user to a facebook page on the facebook app, if installed?

Upon tap of a button, I am trying to send the user to a Facebook page.
I am testing with a random page like this, which exists:
http://facebook.com/WorldwideCollection
Here is how I attempt to launch the page in Facebook app:
NSURL *url = [NSURL URLWithString:#"fb://page/WorldwideCollection"];
if ([a canOpenURL:url]) {
[a openURL:url];
return;
}
Facebook app is logged in and opens. But all I see is my own timeline. It does not direct the user to the page as requested. Is there a different way of doing it?
You need to use profile with the Facebook id for the page :
fb://profile/(fbid)
You need to use facebookID of your page to visit like this
//Stackoverflow Page
fb://page/11239244970
Check this link, this was answered on stackoverflow
Especially check these lines of code.
NSURL *urlApp = [NSURL URLWithString:#"fb://profile/****123****"];
[[UIApplication sharedApplication] openURL:urlApp];

Getting error "This App is not available for your phone" when opening facebook page from iphone app

I am having an app in which I am opening my Facebook Like page.
I am using this Link for that.
But when I try to open this It doesn't go to my Facebook Like page.
It opens up my app with Logo but there is no like page for my app.
It says " This app is not available for your phone."
I have passed the correct AppId from Facebook.
Do I need to set up any additional details from Facebook Developers Guide?
Please help me. Any help will be appreciated.
For my application, I am using this code and it works pretty well. Seems like you are doing something wrong.
NSURL *url = [NSURL URLWithString:#"fb://profile/268179536658143"];
if ([[UIApplication sharedApplication] canOpenURL:url])
{
[[UIApplication sharedApplication] openURL:url];
}
EDIT: You were taking App ID, not the fan page ID. Please correct it.

Open Facebook app to customer's page?

I'm building an iOS app with the Facebook SDK.
One of the things my customer wants is a button that launches the Facebook app and shows their Facebook page. Is there some way to do this, perhaps using a URL?
Thanks.
iPhone has a bunch of URL schemes such as:
NSURL *url = [NSURL URLWithString:#"fb://<insert function here>"];
[[UIApplication sharedApplication] openURL:url];
Check this site out for more:
http://wiki.akosma.com/IPhone_URL_Schemes#Facebook
Also check out this SO post for more info:
https://stackoverflow.com/a/10416399/738262

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

Resources