Play sound in a Sprite kit

I have the following code in myScene.h:

#import <AVFoundation/AVFoundation.h> 

And this code in the touchBegin method:

 [self runAction:[SKAction playSoundFileNamed:@"fire.m4a" waitForCompletion:NO]]; 

The audio file is in the main folder. When I launch the application and touch the application, it shuts off and I get the following error:

 Terminating app due to uncaught exception 'Missing Resource', reason: 'Resource fire.m4a cannont be found in the main bundle' 

I thought this was a way to play audio in the Sprite Kit, but I have to do something wrong.

+6
source share
1 answer

Delete the file from your project and add it again. Do not forget to choose

 Copy items into destination group... 

And select the project as the goal (not a test).

+9
source

All Articles