reidemption
reidemption

Reputation: 61

Calling MusicCatalogSearchRequest() in MusicKit throws .developerTokenRequestFailed Error Swift

I am using the MusicKit API with Swift. I have had a lot of problems with errors when calling MusicKit functions and I can't figure this one out.

Every time I try calling MusicCatalogSearchRequest() it throws this simple error

.developerTokenRequestFailed

It doesn't give any other info lol... Here is my code any ideas are appreciated! Thanks!

Task {
     let status = await MusicAuthorization.request()
     if status != .authorized {
          return
     }
                                    
     do {
          let req = MusicCatalogSearchRequest(term: "weeknd", types: [Album.self, Song.self])
          let res = try await req.response()
          print("Res:", res)
     }
     catch {
          let nsError = error as NSError
          print(error)
          print("Error Description:", nsError.localizedDescription)
     }
}

The "Res:" print is never reached and it errors out at let res = try await req.response()

I am expecting the response to not error out and give me some data from Apple Music

Upvotes: 1

Views: 206

Answers (0)

Related Questions