objective c - I'm getting a sigabrt error when a certain collision is detected (iOS, SpriteKit) -


i building ios app in objective-c. idea of app have sort of rocket ship navigating through asteroid belt of sorts. played in portrait mode. there 2 different kinds of asteroids. normal ones make lose when crash them, , golden ones shoot @ coins.

now, issue occurs when collision detected between bullet , gold asteroid. when collision detected between player , normal asteroid, well, , lose. when collision detected between bullet , gold asteroid, receive sigabrt error.

the code code detects collision following:

- (void)didbegincontact:(skphysicscontact *)contact { uint32_t collision = (contact.bodya.categorybitmask | contact.bodyb.categorybitmask);  if (collision == (playercategory | asteroidcategory)) {     [self player:(skspritenode *)self.player didcollidewithasteroid:(skspritenode *)self.asteroid]; }  uint32_t collision2 = (contact.bodya.categorybitmask | contact.bodyb.categorybitmask);  if (collision2 == (bulletcategory | goldasteroidcategory)) {     [self bullet:(skspritenode *)self.bullet didcollidewithgoldasteroid:(skspritenode *)self.goldasteroid]; } } 

the code runs when "[self player:(skspritenode *)self.player didcollidewithasteroid:(skspritenode *)self.asteroid];" called this:

- (void)player:(skspritenode *)player didcollidewithasteroid:(skspritenode *)asteroid { [self runaction:[skaction playsoundfilenamed:@"explosion.mp3" waitforcompletion:no]];   nslog(@"hit"); [self.player removefromparent]; [self.asteroid removefromparent];  skaction *actionmovedone = [skaction removefromparent]; skaction * loseaction = [skaction runblock:^{     sktransition *reveal = [sktransition crossfadewithduration:0.5];     skscene * gameoverscene = [[gameoverscene alloc] initwithsize:self.size won:no];     [self.view presentscene:gameoverscene transition: reveal]; }];  [self.asteroid runaction:[skaction sequence:@[loseaction, actionmovedone]]]; } 

this code runs when "[self bullet:(skspritenode *)self.bullet didcollidewithgoldasteroid:(skspritenode *)self.goldasteroid];" called:

- (void)bullet:(skspritenode *)bullet didcollidewithgoldasteroid:(skspritenode *)goldasteroid { [self runaction:[skaction playsoundfilenamed:@"ding.m4a" waitforcompletion:no]]; nslog(@"hit"); [self.bullet removefromparent]; [self.goldasteroid removefromparent]; [self plusonecoin]; } 

i believe should enough information , code, not hesitate ask me more, post necessary.

when looked in log, saw there issue sound effect "ding.m4a". replaced coin sound, , works. i'm not sure sound, issue.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -