【问题标题】:why would calling loadMatchWithID:withCompletionHandler crash only on iPad 1 with iOS 5为什么调用 loadMatchWithID:withCompletionHandler 只会在带有 iOS 5 的 iPad 1 上崩溃
【发布时间】:2014-02-16 01:06:20
【问题描述】:

我在 iPad 1 上遇到以下错误并崩溃 - 仅在 iOS 5 上 - 尽管我的 iPhone 5S 和 iPhone 5 运行以下代码段正常:

[GKTurnBasedMatch loadMatchWithID:_match.matchID withCompletionHandler:^(GKTurnBasedMatch *match, NSError *error)
{
 .....
}];

确切的错误是:

由于未捕获的异常而终止应用程序 'NSInvalidArgumentException',原因:'+[GKTurnBasedMatch loadMatchWithID:withCompletionHandler:]: 无法识别的选择器发送到 类 0x3f6d59c0

运行 iPad 模拟器时我没有遇到此崩溃可能一文不值。

【问题讨论】:

  • 该方法(和类)是在 iOS 5.0 中添加的。它应该可以在装有 iOS 5 的设备上运行。iPad 是否有可能有 iOS 5.0 的 beta 副本(可能是还没有该方法的版本)?
  • 奇怪的是,5.1 到 6.0 的发行说明显示了在 iOS 6.0 中添加的方法,但参考文档显示它从 5.0 开始就在那里。你用什么版本的 iPad 模拟器测试过?

标签: ios iphone objective-c game-center


【解决方案1】:

看起来loadMatchWithID 直到 iOS 6.0 才真正公开。我的 Xcode 中有 5.0、5.1、6.0 和 7.0 SDK,并且可以看到在 iOS 6 之前GKTurnBasedMatch.h 中没有此方法。

苹果文档和 iOS 6.0 和 7.0 SDK 标头 GKTurnBasedMatch.h 在某些方法何时可用方面似乎是错误的。

还有其他错误,这不是在 iOS 5.0 中标记为存在的唯一方法,但直到 iOS 6.0 才存在。

以下是我在该标题中发现的其他两个具有相同问题的错误:

- (void)declineInviteWithCompletionHandler:completionHandler

- (void)acceptInviteWithCompletionHandler:completionHandler

【讨论】:

  • 如果文档有误(看起来确实如此),您应该点击文档页面底部的链接将文档错误提交给 Apple。
  • 好电话@maddy,我已将问题提交给Apple,并更新了我的答案以包含该标题不准确的完整列表
  • 非常感谢您的回复foggzilla!至少我可以通过调用“loadMatchesWithCompletionHandler”来解决这个问题,然后遍历所有的匹配 id。再次感谢您。
猜你喜欢
  • 1970-01-01
  • 2014-02-03
  • 2015-06-03
  • 2017-11-29
  • 1970-01-01
  • 1970-01-01
  • 2014-10-27
  • 2015-07-23
  • 1970-01-01
相关资源
最近更新 更多