建立第三方服务器与游戏互动中心 [英] Setting up third-party server to interact with Game Center

查看:169
本文介绍了建立第三方服务器与游戏互动中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想加一个功能,我的iOS游戏,让玩家创造自己的游戏水平,与其他玩家分享,评价他们的,等有会是用户创建水平的公共仓库,排序按创建日期,等级,困难或其他标准。

I'm thinking of adding a feature to my iOS game to allow players to create their own game levels, share them with other players, rate them, etc. There'd be a public repository of user-created levels, sortable by creation date, rating, difficulty, or other criteria.

这类型的功能将需要一个第三方服务器。我想我会用西纳特拉创建一个RESTful API,并在Heroku上运行它。我的问题是:什么是验证请求到该API的最佳方式?我想preFER不要求玩家创建一个用户名和密码。我想只要使用游戏中心的ID系统。

This kind of functionality would necessitate a third-party server. I was thinking I'd create a RESTful API using Sinatra and run it on Heroku. My question is: what would be the best way to authenticate requests to this API? I would prefer not to require players to create a username and password. I'd like to just use Game Center's ID system.

有什么建议?我从来没有做过任何服务器端的东西之前,所以任何帮助AP preciated!

Any suggestions? I've never done any server-side stuff before so any help is appreciated!

是的,我知道,苹果公司并没有提供它自己的系统。但它确实给开发商获得独特的游戏中心标识符(developer.apple.com/library/mac/#documentation/...),我希望我可以用,不知怎的,推出自己的认证系统,而不需要用户通过Facebook签署/微博/等。如果这是可能的。

Yes, I'm aware that Apple doesn't provide its own system. But it does give developers access to unique Game Center identifiers (developer.apple.com/library/mac/#documentation/…) and I was hoping I could use that somehow to roll my own authentication system without requiring users to sign on via Facebook/Twitter/etc. If that's possible.

推荐答案

看起来像通过iOS 7,采用这是可能的游戏中心:

Looks like as of iOS 7, this is possible with Game Center using:

[localPlayer generateIdentityVerificationSignatureWithCompletionHandler]

一旦确认玩家的使用generateIdentity调用的身份,

Once you have verified the identity of the player using the generateIdentity call,


  • 与服务器的数据库用户相关联的玩家ID

  • 使用任何访问令牌/认证模式的REST框架为后续调用

<一个href=\"https://developer.apple.com/library/ios/documentation/GameKit/Reference/GKLocalPlayer_Ref/Reference/Reference.html\">https://developer.apple.com/library/ios/documentation/GameKit/Reference/GKLocalPlayer_Ref/Reference/Reference.html

此外,以供参考,在这里是我们最终根据来自generateIdentityVerificationSignatureWithCompletionHandler

Also for reference, here is the dictionary that we end up sending off to our server based on the response from generateIdentityVerificationSignatureWithCompletionHandler

NSDictionary *paramsDict = @{
    @"publicKeyUrl":[publicKeyUrl absoluteString],
    @"timestamp":[NSString stringWithFormat:@"%llu", timestamp],
    @"signature":[signature base64EncodedStringWithOptions:0],
    @"salt":[salt base64EncodedStringWithOptions:0],
    @"playerID":localPlayer.playerID,
    @"bundleID":[[NSBundle mainBundle] bundleIdentifier]
};

这篇关于建立第三方服务器与游戏互动中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆