2012-07-26 161 views

回答

1

指的是this site。你會非常有幫助。祝你好運

+0

+1教程 – 2012-07-26 08:47:07

-1
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"mysong" ofType:@"mp3"]]; 

    AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:nil]; 

    [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; 
    [[AVAudioSession sharedInstance] setActive: YES error: nil]; 
    [[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; //This line is very important 

    [audioPlayer play]; 

    [super viewDidLoad]; 
+0

這個答案是不夠的,TS要求提供背景音頻。這只是播放一個MP3,並允許使用「刪除控制」 – basvk 2012-07-26 06:52:38

相關問題