我試圖在資源文件夾中獲得10個mp3文件,並在按下按鈕時播放它們。我已經在一個NSMutableArray中輸入了mp3文件的名稱,並且在按下按鈕之後讀取每個文件的名稱。Iphone SDK:pathFoResource:Nsstring問題 - >播放MP3文件
問題是,pathForResource:不起作用(返回nil)。如果我使用的文件名明確般pathFoResource:@「song1.mp3」 ofType:@「MP3」 - 但如果我使用pathForResource:值M whwre值M是一個NSString與鬆1的值
希望你能幫助
問候
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];
嘗試登錄值M,以檢查其是否預期值的字符串... – Vladimir 2010-03-25 09:37:52