EXC_BAD_ACCESS after upgrading to iOS8 SpriteKit game

后端 未结 2 509
被撕碎了的回忆
被撕碎了的回忆 2021-01-22 18:26

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 enabl

相关标签:
2条回答
  • 2021-01-22 18:52

    Try this by setting a unique name for the name property. Somehow worked for me.

    static NSInteger count = 0;
    
    @interface Power ()
    
    - (instancetype)init
    {
        if (self = [super init]) {
            count++;
            self.name = @(count).stringValue;
        } return self
    }
    
    @end
    

    Notice the objects were deallocating more than once. Maybe because wasn't able to distinguish one object to another of the same type.

    0 讨论(0)
  • 2021-01-22 18:56

    So, apparently the problem was in removeFromParent.

    After changing:

    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.

    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.

    0 讨论(0)
提交回复
热议问题