iOS11 加上下面這個(gè)些代碼
try! AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback, with: [])
try! AVAudioSession.sharedInstance().setActive(true)
截圖
image.png
*參考鏈接(英)
*https://stackoverflow.com/questions/41264141/xcode-swift-3-lock-screen-remote-control-not-working
*參考鏈接(中)
*http://www.itstrike.cn/Question/ae1fb577-806a-4d8f-ab3e-17fa76f8c42f.html