游戏中心URL方案

pyr*_*ere 20 ios game-center

可以使用以下命令从您自己的应用程序打开Game Center应用程序:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"gamecenter:"]];
Run Code Online (Sandbox Code Playgroud)

有没有办法在特定游戏的页面上打开它?

jam*_*ack 26

我尝试了很多不同的组合.从iBook缺乏这样的功能来看,缺乏文档,而且我确信你已经发现 - 互联网上缺少信息 - 我会说有人可能不得不蛮力破解URL弄清楚(如果它设置为通过URL转到单个应用程序).以下是我尝试过的一些内容:

    [[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"]];
Run Code Online (Sandbox Code Playgroud)

UPDATE

我梳理了操作系统的内部结构,发现了Game Center的URL解析模式:

Game Center的URL解析模式

你需要精通正则表达式来使用所有这些.以下是我为你输入的一些内容:

    [[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"]];
Run Code Online (Sandbox Code Playgroud)