代码之家  ›  专栏  ›  技术社区  ›  Will Newcombe

无法将“ViewController”类型的值分配给“SPTAudioStreamingDelegate!”设置Spotify API时

  •  0
  • Will Newcombe  · 技术社区  · 7 年前

    试图设置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)
        }
    }
    
    1 回复  |  直到 7 年前
        1
  •  1
  •   Frankie    7 年前

    我猜是这样的 self SPTAudioStreamingDelegate 协议

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

    class MyViewController : SPTAudioStreamingDelegate {
        ...
    }