I have problems with playing sounds on my iPhone programmatically – i don’t understand the explanation in Xcode’s Documentation about AvAudioPlayer.
Could someone else please give me a code snippet, or better, explain it to me?
Edit what I exactly want to do is playing a sound in an infinite loop, starting when the viewdidload, on app exit the music should stop (not playing in background).
It is for a game I am trying to develop
Actually every method i am using is giving back the same error: (log excerpt)
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
edit end
Thanks
Based on your error, your path to the sound file is not valid one (NSURL returns nil for not valid paths).