【问题标题】:Sending an UIImage to multiplayer through GameCenter通过 GameCenter 向多人发送 UIImage
【发布时间】:2012-04-13 11:18:13
【问题描述】:

我有一个来自 CGContext 的 UIImage, 现在我需要通过 GameCenter 发送该图像,另一端的其他玩家应该收到该图像

接受任何链接或代码。 请帮我解决这个问题。

【问题讨论】:

    标签: iphone ios4 ios5 xcode4.2 game-center


    【解决方案1】:

    你有连接玩家以便他们能够接收和发送 NSData 的代码吗? 如果是这样,只需将 UIImage 转换为 NSData 并发送它。 如果没有,请查看本教程以了解游戏中心通信: http://www.raywenderlich.com/3276/how-to-make-a-simple-multiplayer-game-with-game-center-tutorial-part-12

    【讨论】:

    • 我已经按照本教程进行了验证,现在我必须连接播放器,而我没有。当我将 maxPlayers 设置为 10 时,我遇到了一个小问题,我收到如下错误:由于匹配请求无效,因此无法完成请求的操作。这是来自 - (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didFailWithError:(NSError *)error { [presentingViewController dismissModalViewControllerAnimated:YES]; NSLog(@"查找匹配错误:%@", error.localizedDescription); }
    • 本教程是指上面提到的@BobDev提供的
    • 这是另一个我们根本没有足够数据的问题。请创建一个新问题或先尝试更多实验。我自己遵循了本教程,没有任何问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-14
    • 2013-10-30
    • 1970-01-01
    • 2014-10-14
    • 1970-01-01
    • 2012-07-31
    相关资源
    最近更新 更多