Game Center URL scheme

前端 未结 3 1715
难免孤独
难免孤独 2020-12-25 13:45

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

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


        
3条回答
  •  误落风尘
    2020-12-25 13:47

    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"]];
    

提交回复
热议问题