Hi,
I'm currently playing around with the Apple Music Kit inside my iOS application. I want to create a custom playlist and add tracks to that based on trackIDs that are found through the search API.
The search part is now working like a charm, so my Music Token is correct. Now that I try to do anything with the personalized API I'm continously getting a 500 response. It almost feels like the API is bugged. This is the code that I'm running to get the storefronts;
let musicToken = "ey..."
var playlistURLComponents = URLComponents()
playlistURLComponents.scheme = "https"
playlistURLComponents.host = "api.music.apple.com"
playlistURLComponents.path = "/v1/me/"
playlistURLComponents.path += "storefront"
var request = URLRequest(url: playlistURLComponents.url!)
request.httpMethod = "GET"
request.setValue("Bearer \(musicToken)", forHTTPHeaderField: "Authorization")
let dataTask = URLSession.shared.dataTask(with: request) { data, response, error in
if let searchData = data {
let results = try! JSONSerialization.jsonObject(with:searchData, options: [])
print(results)
}
}
dataTask.resume()
The exact error that is being returned in the results is the following;
{
errors = (
{
code = 50000;
detail = "Unable to determine storefront for request";
id = NDJSHMWM52BCFWZFTDRH7XL3LY;
status = 500;
title = "Internal Service Error";
}
);
}
I'm running the app on an actual device, I'm signed in to Apple Music and my storefront is defined. Also I requested all the Apple Music permissions and they are granted. So if anyone knows how to solve this issue let me know!