Posts

Post not yet marked as solved
0 Replies
424 Views
Hi,I would like to show url data on iwatch-3. I am using watchos 6 xcode 10.Just 1 button "sos" and 1 label "veld"It works perfect on the simulator but not on the iwatch-3 device.I use this code. import WatchKitimport Foundationclass InterfaceController: WKInterfaceController { @IBOutlet var veld: WKInterfaceLabel! @IBAction func sos() { print("sos") if let url = URL(string: "https://www.enixs.nl/riva4ravi/time.txt") { do { let contents = try String(contentsOf: url) veld.setText(contents) //veld.settext = (contents) } catch { // contents could not be loaded } } else { // the URL was bad! } } override func awake(withContext context: Any?) { super.awake(withContext: context) // Configure interface objects here. } override func willActivate() { // This method is called when watch view controller is about to be visible to user super.willActivate() } override func didDeactivate() { // This method is called when watch view controller is no longer visible super.didDeactivate() }}
Posted
by ps786723.
Last updated
.