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
Alex Alexander
5,673 PointsSpriteKit Game - Suddenly getting NSInvalidArgumentException?!
Hi,
So I've been making my own, slightly-tweaked version of the Space Cat game and while I was working it suddenly started crashing immediately when I tried to run. The error in the log says:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Resource PressStart.wav can not be loaded'
This was strange to me because the app had been working just a few minutes earlier, and I hadn't been messing with anything relating to the sound. Still, I figured it must be my fault so I went looking for the error but couldn't figure out what I did wrong.
I had a weird feeling though because the line of code where the app was breaking seemed perfect to me. So I downloaded the project files for Amit's version of Space Cat from the final video in the Building a Game course, opened it in Xcode, and tried running that. I got the same error, even though I had made literally no changes to the code, which was downloaded directly from Treehouse.
I'm completely bewildered by this error and I've tried quitting/restarted Xcode and simulator, cleaning my project build, deleting the sound resources and re-adding them, etc. all to no avail. Does anyone have any idea what is going on?!
Thanks, Alex
1 Answer
Alex Alexander
5,673 PointsI figured out how to solve this issue, sort of.
Since the headphone jack on my laptop is broken, I sometimes use an external audio interface connected via Firewire and plug headphones into that. I had my external audio interface plugged in when I was receiving the error described in the OP, but when it's not plugged in, the error doesn't happen.
I still don't fully understand why the audio interface triggers this error, but I at least know that I can stop it from happening by not using the audio interface.