Hello,
I developed an App, which sends and receives Data from a Server.
The App works fine with WatchOS 2 (On Simulator Watch) and the iPhone (iOS 9), which is coppled to the Apple Watch, BUT not on the real Watch with WatchOS 2.
I think, its an configuration problem of the projekt or the watch, because the communication works fine on the Simulator and the iPhone.
Thanks,
Chromo
In watchOS 2 your watch extension is running on the watch itself. It’s typical for the watch not to have any active network interfaces, and thus BSD Sockets communication won’t work. [The watch has a Wi-Fi interface and can activate that interface, but that’s not something that’s under your control.]
Watch extensions are expected to access the network using NSURLSession. This will typically pass the request to the iPhone, allowing the watch to save power by not running the request locally. [Under some circumstances the watch will run the request itself but, again, this isn’t under your control.]
You have a couple of options here:
reformulate your networking in terms of NSURLSession
if that’s not possible (say, you’re talking to a server that requires a custom TCP-based protocol), do that work on the iPhone
With regards the last point, the Watch Connectivity framework makes it easy to pass work back and forth between your watch extension and your iPhone app.
Share and Enjoy
—
Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"