如何从 Game Center 获取 GKPlayer 的状态?
当我获取 GKLocalPlayer
或使用 loadPlayersForIdentifiers:identifiers withCompletionHandler:
获取列表或单个 GKPlayer
别名时,GKPlayer
记录时的对象,看起来像这样:
2010-09-23 10:39:01.759 Cee-lo[76500:207] Players loaded by identity: (
"<GKPlayer 0x84125a0>(playerID: G:1234567890, alias: typeonetester1, status: Adding test friends., rid:(null))",
"<GKPlayer 0x8412530>(playerID: G:1234567890, alias: typeonetester2, status: Adding Game Center to app, rid:(null))"
)
我的问题是,如何从该对象获取status
,以及该对象的类型到底是什么? GKPlayer 类,因此当我执行以下操作时:
GKPlayer *player = [self.friends objectAtIndex:row];
cell.nameLabel.text = player.alias;
cell.statusLabel.text = player.status;
我收到“请求非结构或联合中的成员‘状态’”错误。
When I get a GKLocalPlayer
or use loadPlayersForIdentifiers:identifiers withCompletionHandler:
to get a list or individual GKPlayer
aliases, the GKPlayer
object when logged, looks something like this:
2010-09-23 10:39:01.759 Cee-lo[76500:207] Players loaded by identity: (
"<GKPlayer 0x84125a0>(playerID: G:1234567890, alias: typeonetester1, status: Adding test friends., rid:(null))",
"<GKPlayer 0x8412530>(playerID: G:1234567890, alias: typeonetester2, status: Adding Game Center to app, rid:(null))"
)
My question is, how do I get the status
from this object, and what exactly is the type of this object? There is no "rid" or "status" property in the GKPlayer class, so when I do something like:
GKPlayer *player = [self.friends objectAtIndex:row];
cell.nameLabel.text = player.alias;
cell.statusLabel.text = player.status;
I get a "Request for member 'status' in something not a structure or union" error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
苹果工程师的回答:
Answered by an Apple engineer: