can't get url to work in swift

397 views Asked by At
var url :NSURL = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("MTNSoundTrack", ofType: "aif")!)!

The name of my file and the type are double checked, but still it does not work I'm trying to play a background song in swift spriteKit

1

There are 1 answers

0
Eduardo Rojas Alva On BEST ANSWER

The problem was that the sound was not part of the target so i simply added it

i took this post as a reference: Adding files to separate targets in Xcode 4