Post

Replies

Boosts

Views

Activity

Comment on URLSession.dataTask(with: URL) error: Type of expression is ambiguous without a type annotation
Thanks for the info about editing! Also, thanks for the suggestion -- I changed my code to look like your snippet, but now I'm getting the subject error on the .resume()! (I tried it both with and without the parentheses around "data, response, error" -- made no difference) Update: I tried removing the ".resume()" -- the subject error goes back to the invocation of ".dataTask(with:)"
May ’25
Comment on URLSession.dataTask(with: URL) error: Type of expression is ambiguous without a type annotation
Update: When I remove the ".resume()", the subject error returns to the .dataTask() invocation. Sorry -- I thought using Safari was safe since these are Apple developer forums, but every time I tried to comment, it would give me an error and tell me to try again later, hence the multiple comments with the same info... Also, there doesn't seem to be a way to delete your comments...otherwise I would have deleted this one!
May ’25
Comment on URLSession.dataTask(with: URL) error: Type of expression is ambiguous without a type annotation
I tried removing the do block outside the task and it made no difference. But then I tried removing these two lines: let decoder = JSONDecoder() let ar = try decoder.decode(AAA_Result.self, from: response.value) And the problem went away! So: (1) Why doesn't Xcode specify the error on the line that causes the error, and (2) What is the problem with these two lines?
May ’25