WatchOS URLSession does not work without paired iPhone?

Hallo everyone! I'm working on a WatchOS app uploading files to servers using URLSession. It works fine when the paired phone is there. However, if the paired iphone is not reachable (e.g. switch-off, out-of-reach, etc.), AND the watch is connected to Wifi, the URLSession fails to post messages, and times out.


According to Apple documentation, WatchOS Wifi should work stand-alone.


https://developer.apple.com/documentation/watchkit/keeping_your_watchos_app_s_content_up_to_date/testing_watchos_networking

"Connecting to a known network. If the watch cannot connect to a paired iPhone, but it can connect to a known WiFi network (a network that the user has previously logged into with their phone), then the request is sent using the WiFi network. When connected to a known network, the control center shows the WiFi network in the upper left corner."


I am struggling with this. Does anyone have successful experience, using URLSession and making WatchOS Wifi only connections in the App?


Thanks a lot in advance!

Zhaorui

Replies

Hi Zhaorui, I have the same problem with a cellular Apple Watch Series 3. NSURLSession works fine as long as the Watch is connected to the Phone. But when the Phone is not close or switched off, the NSURLSession gets
Error Domain=NSPOSIXErrorDomain Code=50 "Network is down" UserInfo={_kCFStreamErrorDomainKey=1, _kCFStreamErrorCodeKey=50}
no matter if it is connected via WiFi or Cellular.


Did you solve your problem in the meantime?


Cheers

Christoph

  • Hey did you solve this issue

Add a Comment

Hey I am also getting the same error. My error looks something likes this,

 Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={_NSURLErrorFailingURLSessionTaskErrorKey=LocalDataPDTask <284518A5-63C9-42B2-A51A-EB785693DB8F>.<1>, NSLocalizedDescription=The Internet connection appears to be offline., _kCFStreamErrorCodeKey=50, _NSURLErrorRelatedURLSessionTaskErrorKey=(

    "LocalDataPDTask <284518A5-63C9-42B2-A51A-EB785693DB8F>.<1>"

Did anyone solved this issue

I am still having the problem with iOS 16.5.1 and watchOS 9.4. It’s very frustrating when the Apple documentation is simply wrong. The URL session does not work in my experience unless it’s connected to an iPhone app.

Can you make sure that your watchOS device is completely decoupled from your iOS device by going to the Settings app on iOS and turning off Wi-Fi and Bluetooth. Do not turn them off in Control Center as this may have some edge cases. Then on a physical watchOS device, make sure that you are associated with a known Wi-Fi network and make a dataTask request using NSURLSession in the foreground of your app. If this does not work please post the logs here.