0
我想在我的應用程序來播放聲音(使用SWIFT), 在didFinishLaunchingWithOptions
功能我寫這 的iOS 8,AVPlayer背景音樂播放,remoteControlReceivedWithEvent不叫
AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback, error: nil)
AVAudioSession.sharedInstance().setActive(true, error: nil)
,我有一個UIView
持有的AVPlayer
。
我用:
UIApplication.sharedApplication().beginReceivingRemoteControlEvents()
self.becomeFirstResponder()
和remoteControlReceivedWithEvent
功能。當應用程序進入後臺時,聲音會繼續播放,但是當我點擊暫停按鈕(我們用來播放並暫停應用程序外的聲音)時,remoteControlReceivedWithEvent
永遠不會被調用!
怎麼了?
感謝這是caBecomeFirstREsponder問題:D – user3703910