NSURLErrorDomain error code 1002 description

NSURLErrorDomain error -1002 means NSURLErrorUnsupportedURL or kCFURLErrorUnsupportedURL. It indicates that a bad URL was provided, in most cases, missing http:// from the URL prefix.

The list of all NSURLErrorDomain codes can be found here: https://developer.apple.com/documentation/foundation/1508628-url_loading_system_error_codes


In addition to the above answer, one of the reasons why this could happen is,

You might have set the Allow Arbitrary Loads to false in your Info.plist and the URL you are trying to load is not on a secured server.

The solution to this is either set it to true, or move to a secure connection i.e https://.

Hope it helps someone. All the best.

Tags:

Ios

Json

Swift