Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Game Center URL scheme

Tags:

It's possible to open the Game Center app from your own app using:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"gamecenter:"]];

Is there a way to open it on the page for a specific game?

like image 569
pyrosphere Avatar asked Jun 03 '11 10:06

pyrosphere


People also ask

What is URL scheme in iOS?

A URL scheme allows you to launch a native iOS application from another iOS app or a web application. You can set options in the URL that will be passed to the launched application.

What is app URL scheme?

The app: URL scheme can be used by packaged applications to obtain resources that are inside a container. These resources can then be used with web platform features that accept URLs.

What is a custom URL scheme?

Custom URL schemes provide a way to reference resources inside your app. Users tapping a custom URL in an email, for example, launch your app in a specified context. Other apps can also trigger your app to launch with specific context data; for example, a photo library app might display a specified image.


1 Answers

I've tried many different combinations. Judging by iBook's lack of such a feature, the lack of documentation and as I'm sure you've found—the lack of info on the internet—I'm going to say that someone'd probably have to either brute force the URL to figure it out (if it's set up to go to individual apps by URL at all). Here are some I've tried:

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"gamecenter:id350536422"]];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"gamecenter:us/app/cheese-moon/id350536422"]];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"gamecenter:games/"]];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"gamecenter:350536422"]];

UPDATE

I combed through the internals of the OS and found out the URL resolution patterns for Game Center:

URL resolution patterns for Game Center

You'll need to be savvy with regex to use all of them. Here are some I've typed out for you:

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"gamecenter:/me/account"]];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"gamecenter:/me/signout"]];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"gamecenter:/friends/recommendations"]];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"gamecenter:/games/recommendations"]];
like image 157
james_womack Avatar answered Oct 28 '22 06:10

james_womack