Can't switch between MKMapTypeStandard and MKMapTypeMutedStandard types

I have a MKMapView in my app, and I want the user to be able to switch the map type, so it can be either MutedStandard, Standard, Satellite or Hybrid. I've hooked up a UISegmentedControl on the Map view controller to change the map types. The problem is, as I try to switch between MutedStandard and Standard (or vice versa), the map view never updates! It works fine for every other type change ... and it works if I quit and reload the app, but the real-time map type change never works if it's just between MutedStandard and Standard.

The other strange thing is that it works fine on iOS12 ... just not on iOS13.


Here is the simple code that handles this:


- (IBAction) updateMapTypeSegmentControlValueChanged:(id)sender {
    [[NSUserDefaults standardUserDefaults] setInteger:self.segmentMapType.selectedSegmentIndex forKey:MapViewSettingsDisplayType];
    [self updateMapDisplayType];
}

- (void) updateMapDisplayType {
    NSUInteger mapType = [[NSUserDefaults standardUserDefaults] integerForKey: MapViewSettingsDisplayType];
    switch (mapType) {
        case 0:
        {
            NSLog(@"MapView: updateMapDisplayType - setting to Muted");
            self.mapView.mapType = MKMapTypeMutedStandard;
            break;
        }
        case 1:
        {
            NSLog(@"MapView: updateMapDisplayType - setting to Standard");
            self.mapView.mapType = MKMapTypeStandard;
            break;
        }
           
        case 2:
        {
            NSLog(@"MapView: updateMapDisplayType - setting to Satellite");
            self.mapView.mapType = MKMapTypeSatellite;
            break;
        }
        case 3:
        {
            NSLog(@"MapView: updateMapDisplayType - setting to Hybrid");
            self.mapView.mapType = MKMapTypeHybrid;
            break;
        }
        default:
        {
            self.mapView.mapType = MKMapTypeMutedStandard;
            break;
        }
    }
}


Seems simple enough, but doesn't work on iOS13. I've tried using dispatch_after to make it change the type after 1 second, but that didn't work. Also tried calling

[mapView setNeedsDisplay]
after changing the map type, but that didn't help either.


Any ideas of what I can try to make this work?

Replies

Figured out a work-around .... updating the map's span (i.e. zoom level) causes the tiles to reload, and the updated mapType now shows correctly. I wish that wasn't necessary, but at least it works now.