URI scheme of Google+ iOS app? - ios

I'm working on something cool and I want to link to my Google+ profile in the iOS app.
Has anyone found out how to use the mgc:// URI scheme that the Google+ app on iOS provides to open a specific profile the way you can do it with fb://, twitter:// and almost every other account-based iOS app?

In fact it's really simple. Check your URL in a web browser and replace http:// or https:// with gplus://
Example :
If the URL in your browser is https://plus.google.com/u/0/100711776131865357077 then you open the profile in the app with the following code.
NSURL *gPlusUrl = [NSURL URLWithString:#"gplus://plus.google.com/u/0/100711776131865357077"];
if ([[UIApplication sharedApplication] canOpenURL:gPlusUrl]) {
[[UIApplication sharedApplication] openURL:gPlusUrl];
}

I know this is an old post, but I found the solution here (just search "google"). The URL scheme is gplus://. I have tested this myself and verified that it worked. Usage example:
NSURL *gPlusUrl = [NSURL URLWithString:#"gplus://"];
if ([[UIApplication sharedApplication] canOpenURL:gPlusUrl]) {
[[UIApplication sharedApplication] openURL:gPlusUrl];
}

Related

How to open someone's profile page with their app scope ID in native iOS Facebook app

From Open Graph v2.0 apps no longer can access Facebook user's actual ID, but have to deal with app scope ID. This means in iOS the url scheme link #"fb://profile/123456" no longer works, since we need user's actual ID there.
Is there a way to open user's page with only app scope ID in the native iOS facebook app?
Here is my current code, which produces a "page not found" error in native iOS Facebook app.
NSString *link = [NSString stringWithFormat:#"fb://profile/%#", fbID];
NSURL *facebookURL = [NSURL URLWithString:link];
if ([[UIApplication sharedApplication] canOpenURL:facebookURL]) {
[[UIApplication sharedApplication] openURL:facebookURL];
} else {
NSString *link = [NSString stringWithFormat:#"http://facebook.com/%#", fbID];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:link]];
}
Hi based on this documentation. So the Facebook ID it is the App-scoped User ID. So you can use same based URL schemes as well. Try to use this request to open user profile:
fb://profile?app_scoped_user_id=%#
Also consider this article about this request as well. After all it seems to me you should use Safari to show user profile.
Swift version:
let appUrl = NSURL(string: "fb://profile?app_scoped_user_id=\(id)")!
if UIApplication.sharedApplication().canOpenURL(appUrl) {
UIApplication.sharedApplication().openURL(appUrl)
} else {
UIApplication.sharedApplication().openURL(NSURL(string: "https://www.facebook.com/app_scoped_user_id/\(id)")!)
}
EDIT: This works in theory, but in practice FB don't allow FB:// URLs from third-party apps to open.
This URL scheme opens a user's profile page. Note that it uses the username and not the id number
fb://profile?id=[username]

How to return native app from google map in ios

I am opening google map from native app by below code now i want to return from google map to ios native app.How can i do this. Thanks in advance.
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"comgooglemaps://"]]) {
NSString *url=[NSString stringWithFormat:#"comgooglemaps-x-callback://?saddr=28.458125,77.033833&daddr=18.407000,73.506300&directionsmode=driving&x-success=sourceapp://?resume=true&x-source=lavasa"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}
In the Google Maps Documentation section about the URL scheme there is an example of how the callbackl should work.
x-source The name of the application sending the x-callback request.
Short names are preferred.
x-success — The URL to call when complete.
Often this will be a URL scheme for your own app, allowing users to
return to the original application.
For example:
comgooglemaps-x-callback://?center=40.765819,-73.975866&zoom=14
&x-success=sourceapp://?resume=true
&x-source=SourceApp
Here you see the x-success property, which should be set to your app URL scheme and the x-source is the name of your app as presented in Google Maps app return to app bar.

How to make an action button which takes user to Facebook app in iOS?

I've tried to use the code below but it keeps taking the user to show the website and I need it to take them to a application on the iPhone, ipad and ipod!
- (IBAction)fbIconGo:(id)sender {
NSURL *fbURL = [[NSURL alloc] initWithString:#"https:facebook.com/numberHERE"];
// check if app is installed
if ( ! [[UIApplication sharedApplication] canOpenURL:fbURL] ) {
// if we get here, we can't open the FB app.
fbURL = [[NSURL alloc] initWithString:#"https:facebook.com/NUMBER HERE"];; // direct URL on FB website to open in safari
}
[[UIApplication sharedApplication] openURL:fbURL];
You can do with:
NSURL *url = [NSURL URLWithString:#"fb://profile/<id>"];
[[UIApplication sharedApplication] openURL:url];
Schemes
fb://profile – Open Facebook app to the user’s profile
fb://friends – Open Facebook app to the friends list
fb://notifications – Open Facebook app to the notifications list (NOTE: there appears to be a bug with this URL. The Notifications page opens. However, it’s not possible to navigate to anywhere else in the Facebook app)
fb://feed – Open Facebook app to the News Feed
fb://events – Open Facebook app to the Events page
fb://requests – Open Facebook app to the Requests list
fb://notes – Open Facebook app to the Notes page
fb://albums – Open Facebook app to Photo Albums list
Your URLs should be changed to use the URL schemes instead , Look at these posts for the complete details,
http://wiki.akosma.com/IPhone_URL_Schemes#Facebook
Open a facebook link by native Facebook app on iOS
If you are trying to navigate to a page or a profile , the address should be as follows,
NSURL *url = [NSURL URLWithString:#"fb://profile/<id>"];
[[UIApplication sharedApplication] openURL:url];
You can use Apple URL schemes to communicate with other apps. Read DOCS Communicating With Other Apps
TO open facebook app use fb: URL scheme; i.e.
NSURL *url = [NSURL URLWithString:#"fb://https:facebook.com/NUMBER HERE"];
[[UIApplication sharedApplication] openURL:url];

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

How do I link to a Facebook user in the iOS App by using the username?

I'm trying to link to a specific profile page in the Facebook iOS app by using the (semi-official) URL scheme.
fb://profile/123456789 works fine, but fb://profile/someusername does not. Am I missing something?
This URL works for me: fb://profile?id=<id> where <id> is either the numeric ID or the username.
Not sure whether facebook intends to keep this sort of thing constant, but here is the code that I use in my project. The FB link works on my iPhone (iOS 5) with one of the newer versions of the FB app.
Note that you need the numeric page ID to get the FB app link. This method worked for me: http://inlinevision.com/apps/how-to-find-your-facebook-page-id/
NSURL* direct = [NSURL URLWithString:#"fb://page/NUMERIC_PAGE_ID"];
NSURL* web = [NSURL URLWithString:#"REGULAR_OLD_WEB_LINK"];
if([[UIApplication sharedApplication] canOpenURL:direct]){
[[UIApplication sharedApplication] openURL:direct];
} else {
[[UIApplication sharedApplication] openURL:web];
}

Resources