问题描述
升级到iOS8后,SpriteKit游戏因EXC_BAD_ACCESS而崩溃。在玩了一段时间之后,无缘无故地发生了。异常断点以及在Allocations / Instruments中启用NSZombie检测不会提供任何信息,因此我无法在代码中检测到导致错误的行。
SpriteKit game crashes with EXC_BAD_ACCESS after upgrading to iOS8. Happens at random time, for no apparent reason, after playing a while. Exception breakpoint, as well as enabling NSZombie detection in Allocations/Instruments doesn't give any information, so I can't detect the line in my code that causes the error.
这是回溯:
* thread #1: tid = 0x5d267, 0x2fd7c760 SpriteKit`SKCSprite::update(double) + 328, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xc)
frame #0: 0x2fd7c760 SpriteKit`SKCSprite::update(double) + 328
frame #1: 0x2fd2cec8 SpriteKit`-[SKScene _update:] + 200
frame #2: 0x2fd4a8ae SpriteKit`-[SKView(Private) _update:] + 686
frame #3: 0x2fd47a44 SpriteKit`-[SKView renderCallback:] + 748
frame #4: 0x2fd4485c SpriteKit`__29-[SKView setUpRenderCallback]_block_invoke + 116
frame #5: 0x2fd75fcc SpriteKit`-[SKDisplayLink _callbackForNextFrame:] + 248
frame #6: 0x2f91ad7a QuartzCore`CA::Display::DisplayLinkItem::dispatch() + 98
frame #7: 0x2f91abe2 QuartzCore`CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 366
frame #8: 0x341ca82e IOMobileFramebuffer`IOMobileFramebufferVsyncNotifyFunc + 90
frame #9: 0x2d94a51c IOKit`IODispatchCalloutFromCFMessage + 256
frame #10: 0x2c9dcbe4 CoreFoundation`__CFMachPortPerform + 132
frame #11: 0x2c9ed022 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
frame #12: 0x2c9ecfbe CoreFoundation`__CFRunLoopDoSource1 + 346
frame #13: 0x2c9eb5e0 CoreFoundation`__CFRunLoopRun + 1608
frame #14: 0x2c938db0 CoreFoundation`CFRunLoopRunSpecific + 476
frame #15: 0x2c938bc2 CoreFoundation`CFRunLoopRunInMode + 106
frame #16: 0x33cc4050 GraphicsServices`GSEventRunModal + 136
frame #17: 0x2ff04a30 UIKit`UIApplicationMain + 1440
* frame #18: 0x001073cc p01g01`main(argc=1, argv=0x00456bd4) + 116 at main.m:16
显然,问题以某种方式与SpriteKit相关联。
Apparently, the issue is somehow linked to SpriteKit.
但是在iOS7上,游戏没有任何问题。
On iOS7, though, game works without any problems.
有没有其他方法可以找到并消除问题?
Is there any other method to locate and eliminate the problem?
推荐答案
所以,显然问题出在 removeFromParent
。
更改后:
SKAction *remove = [SKAction removeFromParent];
[self runAction:[SKAction sequence:@[wait, remove]]];
to:
[self runAction:wait completion:^{
[self removeFromParent];
}];
错误已经消失,但另一个出现了:
the error has gone, but another one appeared:
SpriteKit`SKCShapeSprite::getAccumulatedBounds()
有关详细信息,请前往。
Please head to SpriteKit: EXC_BAD_ACCESS SpriteKit`SKCShapeSprite::getAccumulatedBounds() crash for details.
更新:
事实证明我领先于自己:几小时后错误再次出现。现在我有两种无法解决的问题,并且考虑专门为iOS8重写游戏。
UPDATE:It turned out that I got ahead of myself: error popped up again after several hours. Now I have two kinds of unsolvable issues, and thinking of rewriting the game from the ground up specifically for iOS8.
这篇关于升级到iOS8 SpriteKit游戏后EXC_BAD_ACCESS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!