I\'m trying to learn about working with APIs in Swift. As a good first test, I figured I\'d hit the itunes API and just return some search results. I\'m in playground using the
My answer is not correct, it's really only the in the playgound indefinitite page execution. The session type does not matter.
Run into the same issue recently and found a solution.
The error is caused by using URLSession.shared()
which apparently is not allowed in a playground sandbox.
Create and use your own ephemeral URL session instead:
let session = URLSession(configuration: URLSessionConfiguration.ephemeral)