Relative Content

Tag Archive for iosswiftsendgridsendgrid-api-v3

SendGrid API and Swift/iOS – NSURLErrorDomain

I’ve looked at the other questions posted about this, and they haven’t solved my problem, unfortunately. I’m trying to send emails from SendGrid in an iOS app. I’m using the cURL info from SendGrid but doing URLRequest in Swift (v5). On the URLSession.shared.dataTask completion, I get “nil” for both data and response, and an error of “NSURLErrorDomain”. I can’t figure out what I’m doing wrong, or how to debug this successfully. (I did test this against cURL in the command line, and when I do this in the terminal I do receive the emails, so at least the basic data is ok.) Here’s my very magical code: