AVAudion会话中断

时间:2017-02-03 21:36:30

标签: ios

`setSession()         UIApplication.shared.beginReceivingRemoteControlEvents()         becomeFirstResponder()

    NotificationCenter.defaultCenter.addObserver(self, Selector("handleInterruption"), name: AVAudioSessionInterruptionNotification, object: nil)
        //the Error is the line above this comment

    player = Player()

    player.playStream(fileUrl: "http:wwwwww.mp3")

        updatePlayButton()`

我试图通过使用AVAudiointerruptionNotification来检查电话呼叫何时完成,但我做错了什么我继续得到Argument标签_,_,name,object与任何可用的重载都不匹配......

1 个答案:

答案 0 :(得分:0)

在swift 3中使用通知中心的新方法就像休耕一样。我能够编译没有错误或警告!

   NotificationCenter.default.addObserver(self, selector:
   (Selector("handleInterruption")), name:
   NSNotification.Name.AVAudioSessionInterruption, object: nil)