2013-10-12 43 views
0
-(void)loadSong 
{ 
    NSString *song = [[NSBundle mainBundle]pathForResource:@"nintendoMusic" ofType:@"mp3"]; 
    self.musicPlayer = [[AVAudioPlayer alloc]initWithContentsOfURL:[NSURLfileURLWithPath:song] error:NULL]; 
    [self.musicPlayer play]; 
} 

這加載並播放文件「nintendoMusic.mp3」。但是,由於某些原因,如果我從資源包中刪除文件「nintendoMusic.mp3」,此代碼將繼續工作。即使我重置iOS模擬器,它仍然可以繼續工作,並播放歌曲。你知道這是爲什麼嗎?AVAudioPlayer繼續播放歌曲後,我從iOS中的資源包中刪除它

+0

你嘗試做清潔? –

+0

不,但我只是做了,它沒有工作。 – faunta

+0

如果您在設備上啓動應用程序,該怎麼辦?它還在玩嗎? –

回答

3

嘗試刪除從Copy Bundle resource

這首歌像

enter image description here

+0

它不在那裏 – faunta

相關問題