在 iOS 上创建实时房间后,Google Play 游戏服务崩溃

Posted

技术标签:

【中文标题】在 iOS 上创建实时房间后,Google Play 游戏服务崩溃【英文标题】:Google Play Game Services crashing after creating real-time room on iOS 【发布时间】:2014-12-09 07:51:45 【问题描述】:

我正在使用 Google Play 游戏服务为 androidios 开发一款实时多人游戏。我正在使用它的 C++ API 和 Cocos2d-x。

正如 Google 的文档所述,GPG 已在游戏中实现,并且在 Android 上运行良好。但在 iOS 上,当实时房间有足够的玩家时,游戏会崩溃。

快照未启用,我正在使用 Google 的 UI 作为实时房间。

其他功能运行良好,已测试:

朋友的邀请

邀请好友

领导层

显示成就界面

登录 G+ 时的日志:

cocos2d: [LUA-print] Loading game
Signing in to GPG
cocos2d: [LUA-print] Entered background
2014-10-14 15:32:34.539 MYAPP iOS[10716:1633086] VERBOSE: Cancelling event timer
cocos2d: [LUA-print] Entered foreground
Signed in to GPG
MYAPP iOS[10716:1633086] ERROR: Attempting to get name of an invalid Player
MYAPP iOS[10716:1633086] ERROR: Attempting to get avatar URL of an invalid Player
MYAPP iOS[10716:1633086] ERROR: Attempting to get id of an invalid Player
MYAPP iOS[10716:1633086] ERROR: Attempting to get title of an invalid Player
MYAPP iOS[10716:1633086] ERROR: Attempting to get current xp of an invalid Player
MYAPP iOS[10716:1633086] ERROR: Attempting to get last level up timestamp of an invalid Player
MYAPP iOS[10716:1633086] ERROR: Attempting to get current level of an invalid Player
MYAPP iOS[10716:1633086] ERROR: Attempting to get level number of an invalid PlayerLevel
MYAPP iOS[10716:1633086] ERROR: Attempting to get minimum xp of an invalid PlayerLevel
MYAPP iOS[10716:1633086] ERROR: Attempting to get maximum xp of an invalid PlayerLevel
MYAPP iOS[10716:1633086] ERROR: Attempting to get next level of an invalid Player
MYAPP iOS[10716:1633086] ERROR: Attempting to get level number of an invalid PlayerLevel
MYAPP iOS[10716:1633086] ERROR: Attempting to get minimum xp of an invalid PlayerLevel
MYAPP iOS[10716:1633086] ERROR: Attempting to get maximum xp of an invalid PlayerLevel

运行 CreateRealTimeRoom() 后的日志:

MYAPP iOS[10716:1633236] VERBOSE: ProcessedInState is not implemented.
MYAPP iOS[10716:1633236] VERBOSE: OnConnectNetworkStart is not implemented.
MYAPP iOS[10716:1633236] INFO: Connect with retry.getRetryAuthToken(): 1
MYAPP iOS[10716:1633236] INFO: Token expired.  Refreshing.
MYAPP iOS[10716:1633236] Trying to refresh token; old token is: XXX
MYAPP iOS[10716:1633086] Auth updated!  ... maybe.  New token is: XXX
MYAPP iOS[10716:1633236] Token refresh success!
MYAPP iOS[10716:1633236] INFO: Trying to connect with returned auth token.
MYAPP iOS[10716:1633236] VERBOSE: ProcessedInState is not implemented.
MYAPP iOS[10716:1633236] VERBOSE: OnConnectNetworkDone is not implemented.
MYAPP iOS[10716:1633236] VERBOSE: ProcessedInState is not implemented.
MYAPP iOS[10716:1633236] VERBOSE: OnEnterRoomStart is not implemented.
MYAPP iOS[10716:1633236] VERBOSE: OnEnterRoomEnd is not implemented.
MYAPP iOS[10716:1633393] INFO: mPlayerId: 112816036638541164521 Enter room: ChoKCQilzeL2rgQQAhABGAAg____________ARCA1Jb6uNOCgrsB
MYAPP iOS[10716:1633393] VERBOSE: RtmpDcmLog is not implemented.

created a room 1

[RTMP] (Error) +[GPGRealTimeRoomMaker performPreCheck:checkDelegate:]:[main] Sign in to the Google Play Games Service before using the multiplayer functions

在房间有足够的玩家后,应该调用 ShowWaitingRoomUI 的回调,但不是:

MYAPP iOS[10716:1633236] ERROR:  - unhandledMessage: message.type=48
MYAPP iOS[10716:1633393] ERROR: Attempting to get participant for invalid participant id.
MYAPP iOS[10716:1633393] INFO: Waiting for connection from p_CJXeyNKXhKOL3QEQAQ

OnParticipantStatusChanged participant:p_CJXeyNKXhKOL3QEQAQ   status: 2
JOINED OnParticipantStatusChanged participant :p_CJXeyNKXhKOL3QEQAQ
JOINED OnParticipantStatusChanged room :ChoKCQilzeL2rgQQAhABGAAg____________ARCA1Jb6uNOCgrsB
OnParticipantStatusChanged participant participantsInRace_.size: 1
MYAPP iOS[10716:1633394] VERBOSE: RtmpPeerLog is not implemented.
MYAPP iOS[10716:1633394] ERROR: peer_capabilities must not be null in PeerStateMachine::WaitingForOutgoingRemoteConnectionNoSessionId
MYAPP iOS[10716:1633394] VERBOSE: EnteredState is not implemented.    MYAPP iOS[10716:1633394] INFO: OP: 1
MYAPP iOS[10716:1633394] INFO: CALL_STATE_CHANGED_OP: New state: 1
MYAPP iOS[10716:1633394] ERROR: peer_capabilities must not be null in PeerStateMachine::WaitingForConnectionData
MYAPP iOS[10716:1633394] VERBOSE: EnteredState is not implemented.

【问题讨论】:

【参考方案1】:

您是否尝试过使用真正的 iOs 设备? 这个错误发生在我的iphone模拟器中。

【讨论】:

以上是关于在 iOS 上创建实时房间后,Google Play 游戏服务崩溃的主要内容,如果未能解决你的问题,请参考以下文章

一次加入多个房间 Socket.io

使用Google Play游戏服务android成功创建房间后强制启动游戏

使用 socket.io 创建房间

如何检测客户端是不是故意离开 Google Play 游戏实时多人游戏中的房间?

Google-Play-Services:创建自定义候诊室 UI

实时多人房间创建进度卡在 20%