Open Google+ Application in Xcode 4.5

不羁岁月 提交于 2019-12-06 08:48:37
tiguero

According to this post it is not possible to run an app within another app but it is possible to launch any app that registers a URL Scheme. You should check if that's the case for the Google+ Application.

EDIT Google+ doesn't seem to be on the list :-(

Now you are able to launch Google+ app using next protocol:

gplus://

For example

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"gplus://"]];

UPD: So, to launch any page in G+ app you just need to change https:// in URL on gplus://, for example this will launch user profile:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"gplus://plus.google.com/u/0/105819873801211194735/"]];

In Xcode 6 and Swift, you can write:

                let gplusURL = "gplus://your url"    
                if UIApplication.sharedApplication().canOpenURL(NSURL.URLWithString(gplusURL)){
                   UIApplication.sharedApplication().openURL(NSURL.URLWithString(gplusURL))
                }
                else{
                        var alertView = UIAlertView()
                        alertView.addButtonWithTitle("OK")
                        alertView.title = "HEY"
                        alertView.message = "It seems Google Plus is not installed on your device"
                        alertView.delegate = self
                        alertView.show()
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!