iOS11中swift4的MPMusicPlayerController的玩法的歧义使用 [英] Ambiguous use of play of MPMusicPlayerController in iOS11, swift4
本文介绍了iOS11中swift4的MPMusicPlayerController的玩法的歧义使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在运行Apple iOS11 示例向Apple Music添加内容Version 9.0 beta 3 (9M174d)上的a>.
I'm running the Apple iOS11 example Adding Content to Apple Music on Xcode Version 9.0 beta 3 (9M174d)
.
我得到一个Ambiguous use of 'play()
/adding-content-to-apple-music/AppleMusicSample/Controllers/MusicPlayerManager.swift:78:9: Ambiguous use of 'play()'
The suggested solutions to explicitly define the selector in order to avoid the ambiguity like:
let play = #selector(musicPlayerController.play)
在这种情况下不起作用.
did not work in this case.
MusicPlayerManager
类中的MPMusicPlayerController
实例定义为
let musicPlayerController = MPMusicPlayerController.systemMusicPlayer
然后引用为
func beginPlayback(itemID: String) {
musicPlayerController.setQueue(with: [itemID])
musicPlayerController.play()
}
我已经将MusicPlayerManager
类的代码放在此处.
I have put the code for the MusicPlayerManager
class here.
推荐答案
写
(musicPlayerController as MPMediaPlayback).play()
这篇关于iOS11中swift4的MPMusicPlayerController的玩法的歧义使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文