Iphone SDK: pathFoResource:Nsstring problem -> playin MP3 files

Posted by Kaya on Stack Overflow See other posts from Stack Overflow or by Kaya
Published on 2010-03-25T09:30:47Z Indexed on 2010/03/25 9:33 UTC
Read the original article Hit count: 501

Filed under:
|
|
|

I am trying to get 10 mp3 files in the resources folder and play them when a button is pressed. I have entered name of the mp3 files in a NSMutableArray and read each one after the button is pressed.

The problem is that pathForResource: is not working (returns nil). If i use the file name explicitly -like pathFoResource:@"song1.mp3" ofType:@"mp3"- but if i use pathForResource:valuem whwre valuem is an NSstring with value of song1

Hope you can help

Regards

NSString *cellValue0 = [listOfmp3 objectAtIndex:anumber]; NSString *valuem;

if ( [cellValue0 length] > 0 ) valuem = [cellValue0 substringToIndex:[cellValue0 length] - 4];

NSString *pdfPath2 = [[NSBundle mainBundle] pathForResource:valuem ofType:@"mp3"];
NSURL *url = [NSURL fileURLWithPath:pdfPath2];

© Stack Overflow or respective owner

Related posts about nsbundle

Related posts about iphone