NSURLSessionDataTask request to http and https

I have created a plugin that requires NSURLSessionDataTask to access an HTTP API address. The error message is as follows.

Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection., NSErrorFailingURLStringKey=http://api.xxxx.xxxx, NSErrorFailingURLKey=http://api.xxxx.xxxx, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <5B2CEC4E-09E1-4E72-9A0F-6F102A2DF6C8>.<3>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <5B2CEC4E-09E1-4E72-9A0F-6F102A2DF6C8>.<3>, NSUnderlyingError=0x600003948780 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)"}}

Requesting an HTTPS address is not a problem. Is there any way I can request the HTTP protocol?

I added

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

in the plugin’s info.plist file is invalid

The NSAppTransportSecurity info would need to be added to Glyphs directly, not plugins. Are you sure you need to load data from an http: address?

Yes, this interface server is built on a local area network and accessed through an internal IP address without SSL authentication, so currently it can only be accessed through HTTP

The Cocoa APIs do not allow access to none “https” connections. You might need to use lower level API to get to it.

What lower APIs can be used in plugins to access http, can you give me a simple example?

I don’t think that is possible without changes to the app. I believe we can enable access to http: in a future update, but we have to test that first.

I thought about calling curl or something like this. Not sure if that makes a difference.