Posts

Showing posts with the label watchkit

WatchKit and Core Location Not Requesting User Permission

Image
Clash Royale CLAN TAG #URR8PPP WatchKit and Core Location Not Requesting User Permission I cannot get location services on WatchOS 4 to request user permission. My info.plist with privacy usage description in WatchKit Extension is above. My code is below. When it is run, no authorization is requested and I don't get any location updates. private let locationManager = CLLocationManager() override func willActivate() { super.willActivate() locationManager.allowsBackgroundLocationUpdates = true locationManager.delegate = self self.locationManager.requestWhenInUseAuthorization() } func locationServicesAuthorizationStatus(_ status: CLAuthorizationStatus) { locationManager.requestWhenInUseAuthorization() switch status { case .notDetermined: print("LocationServicesAuthorizationStatus: .notdetermined") self.locationManager.requestWhenInUseAuthorization() locationServicesStateNotDetermined() case .restricted, .denied: ...

Why doesn't print() work when sending a message via Apple Watch To iPhone?

Image
Clash Royale CLAN TAG #URR8PPP Why doesn't print() work when sending a message via Apple Watch To iPhone? I am learning how to create a companion Watch App for an iPhone app. (Everything is being done on the simulator) I am sending a message when I tap a button on the Watch app. session.sendMessage(["Message": "It Worked" ], replyHandler: nil) { (error) in print(error) } Then I receive the message in ViewController.swift: func session(_ session: WCSession, didReceiveMessage message: [String : Any]) { print(message["Message"]) print("!!!!") theLabel.text = message["Message"] as! String } Neither print function fire. However I know I am getting the message because my label is being updated. Break points also don't work in this function. If I put another function call in the didRecieveMessage function it will fire. Is this a bug? It made me think my message wasn't being sent for the longest time because ...