玩家标识符字符串可以用作 iOS 中的文件名吗?

发布于 2024-12-20 01:55:03 字数 224 浏览 3 评论 0原文

  • 不要对玩家标识符字符串的内容做出假设。其格式和长度可能会发生变化。

以上文字摘自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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

許願樹丅啲祈禱 2024-12-27 01:55:03

如果您担心播放器标识符字符串包含不能在文件名中使用的字符,最简单的方法是首先对其进行 URL 编码。

例如:

 NSString *encodedFilename = [filename stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

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:

 NSString *encodedFilename = [filename stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文