Simulator says "Lost connection to background transfer service"

When running Beta 1 on device I had no problems but in second beta I can't get it to work, and in the simulator I always get (beta 1 and 2) the following errors when trying to do a network request:


Code=-997 "Lost connection to background transfer service"

Code=-1005 "The network connection was lost."


any ideas why?

I am also getting this on the watchOS 6 beta 2 simulator.

On a Series 3 GPS + watchOS 6 beta 2 it works fine.


Invocation:


let quickSession = URLSession(configuration: .default)
var dataTask:URLSessionDataTask?

if var urlComponents = URLComponents(string: "<URL HERE>") {
    guard let url = urlComponents.url else { return }
    dataTask = quickSession.dataTask(with: url) { data, response, error in
        defer { dataTask = nil }
        if let error = error {
            errorMessage += "DataTask error: " + error.localizedDescription + "\n"
        } else if let data = data,
            let response = response as? HTTPURLResponse,
            response.statusCode == 200 {
            if let array = try? JSONDecoder.init().decode([Model].self, from: data) {
                print(array)
                list = array
            }
        }
    }
    dataTask?.resume()
}


Output:


2019-06-19 07:10:25.016688-0700 iAlert WatchKit Extension[12983:182860] Task <32144E5C-6D9B-43D6-99EF-A8338DA2D0F4>.<1> finished with error [-997] Error Domain=NSURLErrorDomain Code=-997 "Lost connection to background transfer service" UserInfo={_NSURLErrorRelatedURLSessionTaskErrorKey=(

"LocalDataTask <32144E5C-6D9B-43D6-99EF-A8338DA2D0F4>.<1>"

), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <32144E5C-6D9B-43D6-99EF-A8338DA2D0F4>.<1>, NSLocalizedDescription=Lost connection to background transfer service}


It's worth noting when I switched to my device, to run the watchOS simulator an iOS simulator had been launched in the background, but no UI was loaded as far as I could tell.

I bring that up because in this note about installing root certs for ATS, the watchOS simulator has a note that reads:


watchOS Simulator

The watchOS simulator always runs network requests via the paired iPhone simulator, so installing a CA’s root certificate on that paired simulator is sufficient to support watchOS testing.


So possibly this is related to the iOS simulator being in some backgrounded state?

Has anyone found a workaround for this?

I am now blocked trying to create an independent Watch OS 6 App and I don't own a Watch to test it on.

This is no better in Beta 3 :-(

I am getting this same issue - everything has been a barrier during this development.


First the WatchOS SwiftUI would not layout correctly in Beta 1 and would throw the layout with even a Apple Sign In button, and some pods would cause a Error Trap 6 warning and never run!


Now all that is fixed this issue is happening! `Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={NSErrorFailingURLStringKey=https://`


Completely blocked for another 2 weeks?!

Looks like nobody from Apple Watch team is looking at this forum.

I have raised an issue using the feedback assistant, I suggest you all do the same.


https://feedbackassistant.apple.com


This blocks any further development of an independent Watch App.

I'm disappointed, Xcode 11 Beta 4 still haven't fixed it

Just tried it myself, I can confirm it doesn't work in Xcode11 Beta 4.

Have gotten a reply from Apple through the Feedback Assistant (shortly after emailing a senior Apple person for help).

They asked me to check I was running Beta 4 and to include a sample App, I have done both.

I will update everyone when I hear back.

Thanks, let's hope we get a workaround soon :/

Looking at past examples, where it was noted that some devs may experience issues launching apps on the watch simulator (typically first time after an Xcode install and assuming the app will at least install on the sim)...

"Workaround: Launch the app manually on the device and click “Trust” when the security sheet appears. You should then be able to launch the app from Xcode."

I was also blocked by this. The only workaround I've found is to make sure the "paired" iOS simulator is open at the same time - then network requests are working fine. Have also filed a FB (FB6839034).

Wholly S%$t Eastwood, you're the man. Took a bit of fiddling to get the iPhone sim to start, but this indeed works.


Am really dissapointed that no Apple Engineers are monitoring this channel, I am sure they already knew this.

I read the last bit of your post quite a few times and was trying to work out what the last bit meant. Reading Eastwood's reply I know understand what that means. You must have a paired iPhone simulator for network requests to work on the Watch Sim.

Xcode 11 Beta 5 fixed,well done

Simulator says "Lost connection to background transfer service"
 
 
Q