Im having an issue on the Apple Watch when making network calls.
It works fine on the simulator but when deployed to the device I see this in the device logs:
MyAppleWatch kernel(Sandbox)[0] : SandboxViolation: MyWatchApp(203) deny(1) network-outbound /private/var/run/mDNSResponder
The code for making the call is done using refit and works on the simulator so I would imagine it is not the cause but I will post it if necessary.
I have set these values in the Info.plist of the WatchExtensionApp (and not set them in the WatchApp as these keys )
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>my.domain.com</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<true/>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
I set the WatchApp and WatchExtensionApp to:
Just at a bit of loss as to what to try next. Any help would be greatly appreciated.
Ok I got it working, Firstly I changed my
Info.plist
to:I had to change all my network calls to us
NSUrlSession
rather than using Refit + HttpClient. So I assume there is something in theHttpClient
that watchOS doesn't like or watchos only works withNSUrlSession
. Anyway here is a sample of one of my calls:Hope this helps.