I'm trying to get a mp3 from the local Documents on the phone. But I can't get it to work.
If I add the mp3 directly like this to the project it works.
NSURL *soundURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"Sound" ofType:@"mp3"]];
But lets say i have the Sound.mp3 in Documents I tried with this:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *strPointSound = [documentsDirectory stringByAppendingPathComponent:
[NSString stringWithFormat: @"/tours/media/%@", self.point.pointSound] ];
NSURL *soundURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:strPointSound ofType:@"mp3"]];
self.point.pointSound is "Sound.mp3".
Kind Regards.
Change
NSURL *soundURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:strPointSound ofType:@"mp3"]];
to
NSURL *soundURL = [NSURL fileURLWithPath:strPointSound];
Because the Document folder is not a part of your bundle, so you do not need it.