问题描述
可以使用以下方式从您自己的应用程序打开Game Center应用程序:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@ 的GameCenter:]];
有没有办法在特定游戏的页面上打开它?
我尝试了很多不同的组合。从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]];
更新
你需要精通正则表达式才能使用所有这些模式。以下是我输入的一些内容:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@gamecenter: /我/帐户]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@gamecenter:/ me / signout]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@gamecenter:/ friends / recommendations]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@gamecenter:/ games / recommendations]];
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?
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:
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"]];
这篇关于游戏中心URL方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!