sound file cannot be load

No matter what wav file I tried to play in an project, I keep getting the same error. The error states: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Resource namedfile.wav can not be loaded'

I cannot get any sound of any kind to load using SKAction.playSoundFilenamed. I have made sure that the file is names correctly and ıt added correctly so that doesn't seem to be the problem.

I have tested this in several projects, including the following test Game project wherein I use all default code except for a call to the SKAction


class GameScene: SKScene {


override func didMoveToView(view: SKView) {

/ Setup your scene here */ let myLabel = SKLabelNode(fontNamed:"Chalkduster")

myLabel.text = "Hello, World!";

myLabel.fontSize = 65; myLabel.position = CGPoint(x:CGRectGetMidX(self.frame), y:CGRectGetMidY(self.frame));


l
et soundfile = SKAction.playSoundFileNamed("soundProject.wav", waitForCompletion: false)

runAction(soundfile)


self.addChild(myLabel)

}


I cannot get any sound of any kind to load using SKAction.playSoundFilenamed. I already checked to made sure that the file is named correctly and that it exits in the bundle. Any help would be greatly appreciated. Thank you

UPDATE I Ran my attached code on a different computer, and it compliled and ran perfectly. There must be something wrong with my xcode/simulator or mac osx. Any suggestions?

What version of Xcode/OS X are you using on: •your development Mac •the other Mac?

Thanks for reply;

versions same in two machines; osx yosmite 10.10.5 , xcode Version 6.4 (6E35b). Mine is mac mini 2015. Other machine is mac book pro, 2013 i think

Okay, so it's not related to the beta software. Does the crash replicate pretty consistently on your machine, or it it kind of random?

Yeah, it happens everytime. It builds then crash. I saw a guy in another forum solved it with mac's sound settings. But it didnt work for me. Im trying to solve this obout a week now. I see resource can not be upload pop up in my dreams i will cry soon 🙂.

Have you tried it with more than one audio file?

Yes and i tried it with different formats. AVaudioplayer giving same error too. It can be about ios simulator too but dunno what to do.

Wait—you're using iOS? It might be related to the iOS 9 simulator beta. Have you tried it with different simulators? Try switching to iPad—see if it does the same thing. Or download an iOS 8 simulator and try it out there. Let me know how it works!



I guess I should have asked before—I was under the assumption that it was an OS X app.

Thanks for answering me. But sadly still no luck.. I even reset mac to factory settings. Tried with a clean sprite kit project again but didnt work. I wrote a report to apple's bug report, 2 days no answer yet.

As I was thinking about your problem, I realized that since you're still using Xcode 6.4, all the simulators you have are iOS 8. Maybe download the Xcode 7 beta and try the problem on an iOS 9 simulator.


A few other thoughts:

•Does it behave differently when installed on a device?

•Is the audio file actually in the bundle? (Can you find it anywhere in the built product?)


Oh, and don't be surprised if you don't hear back about the bug anytime soon. It can take months if it's not marked high priority.

Also facing this issue with a SpriteKit game and Xcode 7.1. Have you found a fix?


All my sounds used to work find, even tried deleting & readding as .caf files in the correct format. Nothing I do will get any sound file to play or load. All I get is the following error:


SKAction: Error loading sound resource:"jump.caf"

WARNING: 998: Failure to setup sound, err = -50

sound file cannot be load
 
 
Q