玩家标识符字符串可以用作 iOS 中的文件名吗?
- 不要对玩家标识符字符串的内容做出假设。其格式和长度可能会发生变化。
以上文字摘自Apple Game Kit 编程指南中介绍Game Center 时的内容。但我必须至少做出一个假设,即玩家标识符字符串始终可以用作 iOS 中的文件名。原因很简单,一旦获得玩家的标识符字符串,我就必须知道要加载哪个玩家的数据文件。
这能保证吗?如果没有,是否有任何替代方案可以达到相同的目的?
- Do not make assumptions about the contents of the player identifier string. Its format and length are subject to change.
Words above are from Apple's Game Kit Programming Guide when introducing Game Center. But I have to make at least one assumption, that is, a player identifier string can always be used as a filename in iOS. The reason is simple, I have to know which player's data file to load once I get the player's identifier string.
Can this be guaranteed? If not, is there any alternative that achieves the same purpose?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您担心播放器标识符字符串包含不能在文件名中使用的字符,最简单的方法是首先对其进行 URL 编码。
例如:
If you're concerned about the player identifier string containing characters that cannot be used in a filename, the simplest thing to do would be to URL encode it first.
For example: