【问题标题】:Cannot assign value of type 'ViewController' to type 'SPTAudioStreamingDelegate!' When setting up Spotify API无法将类型“ViewController”的值分配给类型“SPTAudioStreamingDelegate!”设置 Spotify API 时
【发布时间】:2018-05-04 04:30:43
【问题描述】:

尝试设置 Spotify API 并遇到如下错误: “无法将类型 'ViewController' 的值分配给类型 'SPTAudioStreamingDelegate!'”在下面的函数中。

我很迷茫,任何帮助将不胜感激。

    func initializePlayer(authSession:SPTSession){
    if self.player == nil {
        self.player = SPTAudioStreamingController.sharedInstance()
        self.player!.playbackDelegate = self
        self.player!.delegate = self
        try! player!.start(withClientId: auth.clientID)
        self.player!.login(withAccessToken: authSession.accessToken)
    }
}

【问题讨论】:

    标签: ios swift3 xcode8 spotify


    【解决方案1】:

    我的猜测是您的视图控制器 self 不符合 SPTAudioStreamingDelegate 协议。

    https://spotify.github.io/ios-sdk/Protocols/SPTAudioStreamingDelegate.html

    class MyViewController : SPTAudioStreamingDelegate {
        ...
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-30
      • 2019-12-03
      • 2017-08-07
      • 2021-03-08
      • 2016-12-24
      • 1970-01-01
      相关资源
      最近更新 更多