ios - SpriteKit runAction:withKey: combined with repeatActionForever: crashes app -


the following code works (i can play sound repeatedly indefinitely):

skaction *playmusic = [skaction playsoundfilenamed:@"sound.m4a" waitforcompletion:no]; skaction *onrepeat = [skaction repeatactionforever:playmusic]; [myscene runaction:onrepeat]; 

the following code works (i can play sound, keyed later access):

skaction *playmusic = [skaction playsoundfilenamed:@"sound.m4a" waitforcompletion:no]; [myscene runaction:onrepeat withkey:@"backgroundmusic"]; 

the following code fails (i cannot key access repeated sound):

skaction *playmusic = [skaction playsoundfilenamed:@"sound.m4a" waitforcompletion:no]; skaction *onrepeat = [skaction repeatactionforever:playmusic]; [myscene runaction:onrepeat withkey:@"backgroundmusic"]; 

there odd clicking instead of sound being played, until app crashes 10-15 seconds later ("terminated due memory error").

does know of problem, or combination of use documented not valid anywhere know of?

so, fix change waitforcompletion:yes.

skaction *playmusic = [skaction playsoundfilenamed:@"sound.m4a" waitforcompletion:yes]; skaction *onrepeat = [skaction repeatactionforever:playmusic]; [myscene runaction:onrepeat withkey:@"backgroundmusic"]; 

since playsoundfilenamed length of action 0, continues try play on , over, leading unhappy sound , memory problems.

i'm not sure if 1 repeat action 1 registered key, or if each 1 being played stomping on previous one. important academic reasons.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -