1 Reply
      Latest reply on May 29, 2019 6:12 AM by davidd
      davidd Level 1 Level 1 (0 points)

        I'm trying to add a map to a watchOS 5 app. Currently, I'm running only on the Simulator.

         

        I can see my pin annotation, but not the map itself. Any help would be appreciated.

         

        Code:

         

        @IBOutlet weak var stationMap: WKInterfaceMap!
           
            var locationManager: CLLocationManager!
            var location = CLLocationCoordinate2D()
            var region = MKCoordinateRegion()
          
            var lat: Double!
            var lon: Double!

         

         override func willActivate() {
                // This method is called when watch view controller is about to be visible to user
                super.willActivate()
                
                location.latitude = (CLLocationDegrees(lat))
                location.longitude = (CLLocationDegrees(lon))
                
                //NSLog(@"Map: mapDetailArray: %@", self.mapDetailArray);
                
                locationManager = CLLocationManager()
                let spanX: Float = 0.005
                let spanY: Float = 0.005
                
                
                region.center = location
                region.span.latitudeDelta = CLLocationDegrees(spanX)
                region.span.longitudeDelta = CLLocationDegrees(spanY)
                stationMap.setRegion(region)
                
                
                stationMap.addAnnotation(location, with: .red)
            }