I've run into a problem when coding my first iOS app, so please be patient shouldn't I post nonsense or don't understand your answer directly without asking a second time.
I've written this code:
func updateWatch() {
if motionManager.isAccelerometerAvailable == true {
if let z: Double = motionManager.accelerometerData?.acceleration.z {
print("test succeeded)
}
} else {
//Timelabel is a UILabel
timeLabel.text = "Sorry"
}
}
}
updateWatch() is linked to a scheduledTimer with repeat = true (stopwatch) When executing on my iPhone 6s the label says "sorry".
What causes the if let statement to be false and how can I work around it.
Thanks in advance for any help :)
Aucun commentaire:
Enregistrer un commentaire