2

I'm creating an app that wants to get a JSON file (or any data) from a local web server (MAMP) without having an iPhone that communicate with the server, parse the file and eventually sends the data to the Apple Watch via WatchConnectivity.

Is it possible? Is there any API I could use?

I've seen that the apps preinstalled on the watch can get data from the Web even with the iPhone turned off relaying only on the Wifi connectivity: for example the Apple's map app.

Thank you!

1 Answer 1

2

Yes. As long as the watch has a network connection, via WiFi, cellular or through Bluetooth to its paired phone then you can use networking features, such as URLSession to fetch web content.

Even if the watch does piggyback off the phone's network connection, it doesn't require you to send data "through" the companion app.

As of watchOS 6.0, watch apps don't need a phone companion app; they can be stand-alone.

Sign up to request clarification or add additional context in comments.

3 Comments

thanks for the answer :) Can I use Alamofire and SwiftyJSON on Apple Watch?
Yes, both of those seem to have watchOS support, but unless you have existing code you are trying to re-use I would start with URLSession and Codable before introducing external dependencies.
ok thanks! I tried using both Alamofire and SwiftyJSON because I think they are easier to use... and they work perfectly!!! xD

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.