0

I am building a watch only application which contains some api requests to be integrated such that data should be shown. I am using the apple watch se and I have turned on the wifi in the watch. But when I am making an api request for example, Guess I am trying to display a list and inorder to obtain that list I am required to make an api call from the watch app itself and I have written the required code.

There are 4 different scenarios I tested and these are the results

1.IPhone wifi on, watch wifi on - works

2.IPhone wifi on, watch wifi off - works

3.IPhone wifi off, watch wifi on - doesn't work

4.Both switched off - doesn't work

1,2,4 can be accepted. But I am not sure why 3 is not working. I tested the app store in the watch as well following the above 4 scenarios and still the results are same. So my hypothesis is that it's the behaviour of the watch. But i am not sure the reason why 3. is not working since I am making a standalone app and the watch supports wifi or internet connection why can't we directly pull data via the watch internet connectivity? But I am surprised when siri was working fine in 3rd scenario. Please someone who can elaborate the reason will be greatly appreciated.

Error 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>",
    "LocalDataTask <284518A5-63C9-42B2-A51A-EB785693DB8F>.<1>"

Furthermore, the above error is coming while making a request based on the 3rd scenario. (Please note the wifi in watch is turned on) Thanks in advance!

jnpdx
  • 45,847
  • 6
  • 64
  • 94
SVG
  • 809
  • 6
  • 21
  • How are you Turing off the wifi on the phone? Make sure that the wifi off state isn't syncing to the watch. It can do that. Also, make sure your watch is connecting to a 2.4ghz wifi. The watch doesn't support 5Ghz wifi – Paulw11 Sep 09 '21 at 09:21
  • Hi @Paulw11 Yeah connected wifi is 2.4Ghz. What do you mean by syncing the wifi state? I turn off the wifi in phone, but my watch is still connected to the wifi. :( Is this what you meant? – SVG Sep 09 '21 at 09:26
  • Yes. For example, if you activate airplane mode on your phone it also activates on your watch – Paulw11 Sep 09 '21 at 09:33
  • When you slide upon the watch do you see a blue wifi symbol and network name or the green phone symbol? – Paulw11 Sep 09 '21 at 09:36
  • @Paulw11 yeah it's not synced. Though I switch off wifi in iphone, my watch is still connected – SVG Sep 09 '21 at 09:37
  • I see the blue wifi symbol and the green color phone icon. And when I long press on the wifi icon it shows connected and the wifi name – SVG Sep 09 '21 at 09:38
  • 1
    If you see the green phone icon, you are still connected to the phone. Try turning your phone off. – Paulw11 Sep 09 '21 at 09:40
  • Oh wow Thank you @Paulw11. Now it works :). But why can't it communicate even while the phone is on and wifi is switched on in the watch? Is it a limitation or the behaviour? – SVG Sep 09 '21 at 09:43
  • 1
    The watch always prefers to communicate via the phone if it can. I guess it saves battery – Paulw11 Sep 09 '21 at 09:49
  • Oh I now get it. Btw thanks a lot @Paulw11. One and last question, what if I want that kind of a behaviour (Force to make the request via the watch wifi). Is it possible? – SVG Sep 09 '21 at 10:10
  • 1
    Not as far as I know, you just send the request and WatchOS decides how to route it – Paulw11 Sep 09 '21 at 10:21
  • Hi @Paulw11, Do you have any idea about how to publish the standalone watch os app to the appstore/ testflight? I dig quite a lot, but would like to ask you whether, when creating the identifier in the portal, should it be the Watchkit app's bundle id or extensions bundle id or the bundle id of the empty IOS project which creates automatically? – SVG Oct 08 '21 at 08:57
  • https://developer.apple.com/forums/thread/124943 – Paulw11 Oct 09 '21 at 03:20
  • Not sure if this answers the OP, but if you turn Bluetooth off on your iPhone, the Watch will use the inbuilt Wifi. – Rich Barber Jan 07 '22 at 03:14

0 Answers0