Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Game with Sprite Kit Artificial Intelligence and Sound Adding Sound Effects

Cesar Guerrero
Cesar Guerrero
11,190 Points

Getting a runtime error when adding the music to my game, "Thread 1: signal SIGABRT"

Here is my code for the titleScene.m file

    #import "TitleScene.h"
    #import "GamePlayScene.h"

    @interface TitleScene ()
    @property (nonatomic) SKAction *pressStart;
    @end

    @implementation TitleScene
    -(id)initWithSize:(CGSize)size
    {
        if (self = [super initWithSize:size])
        {
           SKSpriteNode *background = [SKSpriteNode spriteNodeWithImageNamed:@"splash_1"];
            background.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame));
            [self addChild:background];
            self.pressStart = [SKAction playSoundFileNamed:@"PressStart.caff" waitForCompletion:NO];
        }

        return self;
    }

    -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    {
        GamePlayScene *gamePlayScene = [GamePlayScene sceneWithSize:self.frame.size];
        SKTransition *transition = [SKTransition fadeWithDuration:1.0];
        [self.view presentScene:gamePlayScene transition:transition];
    }

    @end

    ```
Cesar Guerrero
Cesar Guerrero
11,190 Points

And just like that, it worked.. Sorry to bother. I actually have no idea what was going on or what that error even is.

3 Answers

Stone Preston
Stone Preston
42,016 Points

that means an exception was thrown. in the console if you scroll down there will be more information that will tell you more about what is actually causing the error

Jeff Golden
Jeff Golden
8,460 Points

I ran into the same issue, in my case it was telling me that the audio file couldn't be found in the bundle. Turned out when I imported the files I failed to check the Add To Targets checkbox in the import dialog, that confirms the copy of the file into the project. Hope this helps someone.

yeah i had that problem, not setting the target to the project when importing the files threw this error when looking it up.