var audioPath = NSURL(fileURLWithPath: Bundle.main.path(forResource: "vellipomaakey", ofType: "mp3")!).
fatal error: unexpectedly found nil while unwrapping an Optional value
var audioPath = NSURL(fileURLWithPath: Bundle.main.path(forResource: "vellipomaakey", ofType: "mp3")!).
fatal error: unexpectedly found nil while unwrapping an Optional value
You are force unwrapping your optional, consider the following:
if let res = Bundle.main.path(forResource: "vellipomaakey", ofType: "mp3") {
var audioPath = NSURL(fileURLWithPath:res)
}
This will most likely take away your run time error but it won't solve your issue. The problem here is that the resource you are trying to load is not being found, so Bundle.main.path(forResource: "vellipomaakey, ofType: "mp3")
is returning nil
.