I am new in Apple Watch development and want to integrate apple map in Apple Watch in which just want to show my current location but every time i load the interface in simulator i got the screen like below. any help can be appreciate.
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
CLLocation* loc = [locations lastObject];
CLLocationCoordinate2D myLocationCoordinate2D = loc.coordinate;
[self.demoMap setRegion:MKCoordinateRegionMake(myLocationCoordinate2D, MKCoordinateSpanMake(0.0,0.0))];//set map region
[self.demoMap addAnnotation:myLocationCoordinate2D withPinColor:WKInterfaceMapPinColorGreen];// set pin on map
[locationManager stopUpdatingLocation];
}
#pragma mark - CLLocation Manager
-(void)startTrackingCurrentLcoation:(BOOL)forTrip
{
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager requestAlwaysAuthorization];
CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
if (status == kCLAuthorizationStatusAuthorizedAlways || status == kCLAuthorizationStatusAuthorizedWhenInUse)
{
NSLog(@"%@ Start tracking current location", self);
[locationManager startUpdatingLocation];
}
}
-(void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
{
status = [CLLocationManager authorizationStatus];
if (status == kCLAuthorizationStatusDenied)
{
NSString *message = @"To use background location you must turn on 'Always' in the Location Services Settings";
NSLog(@"%@",message);
}
else if (status == kCLAuthorizationStatusNotDetermined)
{
[locationManager requestAlwaysAuthorization];
}
else
{
[locationManager startUpdatingLocation];
}
}
Follow this link https://trymakedo.wordpress.com/tag/wkinterfacemap/.
Check weather you getting current location coordinate that you pass to region.Test by giving predefined coordinate..