I am trying to make a simple example of a watch app: a label and a button. Press the button and the text of the label should change.
@IBOutlet var myLabel: WKInterfaceLabel!
@IBOutlet var myButton: WKInterfaceButton!
The following code results in an endless spinning wheel when I run the app in the simulator as shown in the screenshot:
@IBAction func sampleFunc() {
myLabel.setText("hello world")
myButton.setTitle("hermes")
}
Keep in mind. The app never gets to load. I never get to see the button or label. It just stays stuck on this spinning white wheel of dots.
But if I take the exact same code and simply comment out the label, the watch app loads and runs fine.
@IBAction func sampleFunc() {
//myLabel.setText("hello world")
myButton.setTitle("hermes")
}
Results in:
And if I click the button, it changes to "hermes" as intended:
Why on earth would this happen? I have been sitting here for four solid hours trying to figure this out. The label is connected as an IBOutlet. I have cleaned the project. I have shut down XCode, restarted my entire computer. I have made a second project from scratch. All the same. Why can't I simply leave this label uncommented? Why does the app never load if the label is uncommented in the action of the button? Extra info: Even if I place the uncommented label elsewhere, such as in the willActivate() method, it behaves the same way with the app never loading.