【问题标题】:SpriteKit crash on [self removeAllActions];[self removeAllActions] 上的 SpriteKit 崩溃;
【发布时间】:2015-10-01 05:28:41
【问题描述】:

刚刚进入开放的 iOS 9 Beta(第 3 版),我的应用现在在这条线上崩溃了:

[self removeAllActions]; // where "self" is an SKNode

编辑:进一步挖掘后,我发现当 removeAllActions 在完成处理程序中时会出现问题:

[self runAction: someSKAction completion:^{
    [self removeAllActions]; // this will cause the crash
}];

控制台中的错误状态:

libc++abi.dylib: terminating with uncaught exception of type std::out_of_range: vector

还有其他人遇到这种问题吗?

编辑:iOS7 或 iOS8 的任何版本都没有这个问题。我向 Apple 提交了错误报告,报告 #21788047

【问题讨论】:

  • @sangony 感谢您的链接;我会调查的。我的操作与加载我的纹理或任何形式的 + (SKAction *)animateWithTextures:(NSArray *)textures 无关。就像在另一个线程中建议的那样,我将在我的数组周围设置日志并查找 nil 对象
  • 在 iOs 12 和 Swift 上出现同样的错误。

标签: ios iphone ipad sprite-kit ios9


【解决方案1】:

iOS 9 Beta 4 解决了这个问题。更新后,我进行了一些测试,一切似乎都很顺利。

【讨论】:

    【解决方案2】:

    我遇到了这个问题,这是因为存在对 SKNodeactions 数组的并发访问。

    我通过使用semaphore 摆脱了它。这不是理想的解决方案,但至少它不会崩溃。

    【讨论】:

      最近更新 更多