i am trying to parse json from an url it is working fine in watch simulator but not working in apple watch. watch have active internet connection with wifi. All other apps which use internet are working fine in watch.
Console response:
Complete code
struct ContentView: View {
var body: some View {
VStack {
Text("Hello world")
}
.onAppear{
do {
guard let url = URL(string: "https://jsonplaceholder.typicode.com/todos/1") else { return }
let data = try Data(contentsOf: url)
let json = try JSONSerialization.jsonObject(with: data)
print("json \(json)")
}
catch let error {
print("error \(error.localizedDescription)")
}
}
.padding()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}