游戏中心 API +应用内购买 API = 单个应用程序有两个不同的用户帐户?
如果我有一个支持 Game Center 的应用程序,并且我想提供用于完成作为应用程序内购买出售的拼图包的成就,我如何将因应用程序内购买而收费的 iTunes 帐户与游戏同步进行购买的中心用户帐户?据我了解,它们是两个独立的用户帐户,可以在两个不同的位置访问(游戏中心帐户在游戏中心应用程序中访问,iTunes 帐户在设置应用程序中访问)。
我如何避免这种情况发生...
- Game Center Player1 登录,运行我的应用程序并购买拼图包
- Game Center Player1 注销,Game Center Player2 登录,运行我的应用程序并玩完 Player1 购买的拼图包, Player2 被授予成就。
- Game Center Player2 注销,Game Center Player1 登录并发现他/她购买的拼图包已完成,因此 Player1 无法获得相同的成就。
我是否误解了这些用户帐户的工作方式?如果没有,当玩家登录和退出我的游戏时,是否可以将 Game Center 帐户与 iTunes 帐户同步?有什么办法可以解决这个问题吗?对于任何销售内容的多人游戏来说,这似乎是一个相当普遍的问题。
非常感谢!
If I have an app that supports Game Center and I'd like to provide Achievements for completing a puzzle pack that's sold as an in-app purchase, how do I sync the iTunes account that's being charged for the in-app purchase with the Game Center user account that's doing the buying? As I understand it, they're two separate user accounts that are accessed in two different locations (The Game Center account is accessed in the Game Center app and the iTunes account is accessed in the Settings app).
How do I avoid this from happening...
- Game Center Player1 logs in, runs my app and purchases a puzzle pack
- Game Center Player1 logs out, Game Center Player2 logs in, runs my app and plays to completion the puzzle pack that Player1 purchased and Player2 is awarded the Achievement.
- Game Center Player2 logs out, Game Center Player1 logs in and finds the puzzle pack he/she purchased as already completed, so Player1 is unable to gain that same achievement.
Am I misunderstanding something with how these user accounts work? If not, is there a way to sync a Game Center account with an iTunes account as players log in and out of my game? Is there any kind of a work around for this problem? This seems like it would be a fairly common issue with any multiplayer games that sell content.
Thanks so much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这是一个好问题。 :) 就成就而言,我想您可以使用登录的 GKPlayer 中的playerId 将它们存储在设备上,并且一旦登录的玩家完成了成就,您就可以与 Game Center 同步。
至于同步 iTunes 和 Game Center 帐户我真的不知道。通常,您会在设备上存储一些有关是否已进行购买(即可用功能)的信息。使用该功能(或被允许使用它)应该依赖于设备,而不是依赖于 GC 用户,这符合逻辑吗?但是,如果有人使用他们的帐户一次又一次地将您的内容下载到他们朋友的设备上,会发生什么呢?
嗯...我希望其他人能分享他们对此的想法。但我发现游戏中心问题的浏览量和答案都非常低:(
That is a good question. :) As far as achievements go, I guess you could store them on the device with the playerId from the logged in GKPlayer, and once an achievement has been finished for a logged in player, you synch with Game Center.
As far as synching iTunes and Game Center accounts I really don't know. Usually you store some information on whether a purchase has been made (i.e. a feature available) on the device. Would it be logical that using that feature (or being allowed to use it) should be device dependent, not GC user dependent? But then what happens if someone uses their account to just download your content again and again to their friends' devices?
Hmm... I hope some other people will share their thoughts on this. But I found that Game Center questions receive very low views and answers :(
这就是我将如何做到这一点,这实际上是一个相当简单的方法。我将使用核心数据在本地跟踪用户购买的拼图包的进度,因为它可以快速启动和运行。每次新的 GC 用户登录时,我都会创建一个新的用户对象并跟踪他们在拼图包中的进度,并在需要时在 GC 中报告成就。当 GC 用户稍后登录时,我将调整拼图包的状态以匹配核心数据中定义的当前进度。这样,任何 iTunes 帐户都可以购买拼图包,并且任何使用该设备的人都可以使用它们。每当任何 GC 用户登录 GC 并玩我的应用程序时,他们都可以访问相同的购买拼图包,但他们的进度和成就将独立于其他 GC 用户进行维护。
如果设备上未安装 GC,我可以禁用所有 GC 功能并仅初始化应用程序,因为只有一个默认播放器。
做起来应该很简单。
So here's how I'm going to do this, it's actually a fairly straightforward approach. I'm going to locally track users progress in the purchased puzzle packs using core data, since it's quick to get up and running. Each time a new GC user logs in, I'll create a new user object and track their progress in the puzzle packs and report the achievements in GC when needed. When that GC user logs in later, I'll just adjust the state of the puzzle packs to match their current progress defined in core data. This way, any iTunes account can purchase the puzzle packs and they'll inherently be available to anyone using the device. Whenever any GC users log into GC and play my app, they'll all have access to the same purchased puzzle packs, but their progress and achievements will be maintained independently of other GC users.
If GC isn't installed on the device, I can disable all GC features and just init the app as tho there's only one default player.
Should be simple to do.
我也在尝试提出解决方案来解决这个问题。如果采用服务器产品交付模式,问题就可以得到很大程度的解决。应用程序将购买的商品发送到服务器;服务器在检查凭据后将商品交付给应用程序。有一些极端情况我仍然不知道如何解决,基本上是处理整个流程中断的情况,这取决于IAP的实现。还没有100%确定。
I am trying to come up with the solution to resolve this issue as well. If using the server product delivery mode, the problem could be largely resolved. The application sends the purchased items to server;sever deliver the item to application after checking credentials. There are some corner cases I still don't know how to resolve, basically to handle the case when the whole flow is interrupted, which depeneds on the implementation of IAP. Still not 100% sure yet.
您能否在手机上记录特定用户购买了哪些成就,然后检查哪个用户正在使用并启用或禁用购买的内容 - 您必须有一种方法来跟踪不同玩家的进度(我可以看到用户可能无法登录 GC 等潜在问题。我还没有这样做,不过我正在为我的下一场比赛做计划。
Could you keep a record on the phone about which achievements have been bought by particular users, and then check which user is on and either enable or disable the purchased content - you'd have to have a means of keeping track of different players progress (I can see potential problems where a user might not be logged in to GC, etc etc). I haven't done this yet, tho I'm planning it for my next game.