在尝试播放歌曲时,Spotify播放器会抛出模糊错误

时间:2017-09-07 18:29:58

标签: ios swift spotify

我正在尝试使用Spotify API播放一首歌,我已经发现了permium,但是当我尝试运行下面的代码时,我收到错误Optional(Error Domain=com.spotify.ios-sdk.playback Code=1 "The operation failed due to an unspecified issue." UserInfo={NSLocalizedDescription=The operation failed due to an unspecified issue.})

func initalizePlayer(authSession: SPTSession) {
        if self.player == nil {
            self.player = SPTAudioStreamingController.sharedInstance()
            self.player!.playbackDelegate = self
            self.player?.delegate = self
            try! player!.start(withClientId: clientId)
            self.player!.login(withAccessToken: authSession.accessToken)
            print("done initalizing")
        }
    }

    public func play() {
        player?.playSpotifyURI("spotify:track:7FOJvA3PxiIU0DN3JjQ7jT", startingWith: 0, startingWithPosition: 0, callback: { (error) in
            if error != nil {
                print(error)
                return
            }
        })
    }

0 个答案:

没有答案