升级到 iOS8 SpriteKit 游戏后的 EXC_BAD_ACCESS [英] EXC_BAD_ACCESS after upgrading to iOS8 SpriteKit game

查看:15
本文介绍了升级到 iOS8 SpriteKit 游戏后的 EXC_BAD_ACCESS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升级到 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.

So, apparently the problem was in removeFromParent.

更改后:

SKAction *remove = [SKAction removeFromParent];
[self runAction:[SKAction sequence:@[wait, remove]]];

到:

[self runAction:wait completion:^{
    [self removeFromParent];
}];

错误已经消失,但又出现了一个:

the error has gone, but another one appeared:

SpriteKit`SKCShapeSprite::getAccumulatedBounds()

请前往SpriteKit: EXC_BAD_ACCESS SpriteKit`SKCShapeSprite::getAccumulatedBounds() 崩溃了解详情.

更新:事实证明,我超前了:几个小时后再次弹出错误.现在我有两种无法解决的问题,正在考虑专门为 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆