I am trying to program an application containing several songs. Looking through various tutorials, they just say βadd your file to the projectβ or some of them, so I tried to add my MP3 to different places (including xcassets), but it is never copied to the output of my project or is not played.
In other words, this always returns nil:
let path = NSBundle.mainBundle().pathForResource(audioFile, ofType: "mp3")
It seems like dead simple stuff, and it drives me crazy that it will not just play the file. I tried this in the root directory, in the directory that I create with the name "resources" (as several sources say "add it to resources") and even in xcassets. However, it always returns to zero.
Please note that I am in Xcode 7 (beta) developing the latest iOS and using Swift 2. The file size is about 53 MB.
Any help is much appreciated!
ios xcode nsbundle
Mark brittingham
source share