One gotcha to be aware of is that NSURLSession will call your call back on a background thread. It is up to you to switch over to the main thread (GCD or other mechanism).
t
Tony
11/01/2019, 5:58 PM
Is there a way to set the NSURLRequest.HTTPMethod to "GET"?
oh! that is very nice to know @Sam. thank you for that bit!
Ah! There is a NSMutableURLRequest... 😢
s
Sam
11/01/2019, 6:13 PM
That's a common pattern with the Cocoa frameworks.
t
Tony
11/01/2019, 6:14 PM
very interesting. how did you figure that out?
s
Sam
11/01/2019, 6:16 PM
I came to Kotlin after doing over 5 years of iOS development. It's just one of those things you learn when learning Obj-C.
t
Tony
11/01/2019, 6:21 PM
ahhhh! i'm glad you told me about that quirk about NSURLSessions
👍 1
If my dispatcher for my coroutine is dispatch_get_main_queue(), do I need to bring it to the main thread when I use NSURLSession?