1

I'm using the Spotify iOS SDK and trying to get use this function starredListForUserInSession:callback: to find a user's starred list once they have logged in.

The actual logging in of the user is working correctly, as I am able to stream Spotify tracks and a valid SPTSession is returned. I am including both the streaming and the playlist reading scopes as seen below:

SPTAuth *auth = [SPTAuth defaultInstance];
NSURL *loginPageURL = [auth loginURLForClientId:kSpotifyClientID
                            declaredRedirectURL:[NSURL URLWithString:kSpotifyCallbackURL]
                                         scopes:@[SPTAuthStreamingScope, SPTAuthPlaylistReadPrivateScope]];

However, when I use the function:

[SPTRequest starredListForUserInSession:[AppDelegate sharedAccounts].spotifySession callback:^(NSError *error, id object) {

    if (error) {
       NSLog(@"%@", error);
    }

}];

I consistently receive the following error: "The operation couldn’t be completed. (NSURLErrorDomain error -1012.)" UserInfo=0x7a8cbf50 {NSErrorFailingURLKey=https://api.spotify.com/v1/users/(null)/starred, NSErrorFailingURLStringKey=https://api.spotify.com/v1/users/(null)/starred, NSUnderlyingError=0x7a6d5b60 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1012.)"

When I looked this up, it said that it means this request requires authentication, though the user has already been authenticated with the presumably correct scope. What am I missing?

4

0 回答 0