Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MKMapView not Rendering in iOS 8 or later

Tags:

ios8

mkmapview

I'm having an issue in MKMapView in iOS 8.x.x. Application works fine iOS 7.x.x but not in iOS 8.x.x. On device it shows only annotations but no map behind.

I tried to forcefully Reset my Device as well but no luck.

I added these 2 Values in info.plist as well as it was a requirement for iOS 8 and onwards

<key>NSLocationAlwaysUsageDescription</key>
<string>Location is required to find out where you are</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Location is required to find out where you are</string>

and added this lines of code in my Viewdidload.

// Check for iOS 8. Without this guard the code will crash with "unknown selector" on iOS 7.
    if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)])
    {
        [self.locationManager requestWhenInUseAuthorization];
        //[self.locationManager requestAlwaysAuthorization];
        self.myMapView.showsUserLocation = YES;
    }

By adding these 2 values in info.plist and the above lines of code, I'm able to get the User's Location and annotation in showing on map for user's location but Map is Blank.

Similar to this post: MKMapView showing blank screen in iOS 8

Blank Map View with annotation

like image 369
Ammad Khan Avatar asked Dec 18 '14 07:12

Ammad Khan


2 Answers

Had the very same thing on IOS8.3 both sim and device. Solved by running the system Maps App (it displayed empty grid as well) for a minute till it downloaded maps. After that my MKMapView started rendering as normal.

like image 109
Paweł Węglewski Avatar answered Nov 17 '22 21:11

Paweł Węglewski


try add the delegate methods:
- (void)mapViewWillStartLoadingMap:(MKMapView *)mapView; - (void)mapViewDidFinishLoadingMap:(MKMapView *)mapView; - (void)mapViewDidFailLoadingMap:(MKMapView *)mapView withError:(NSError *)error; and check the solution for you error message.

also check this solution i don't got rid of the grind but at least i got rid of the didFail error.

but seems to be an issue of iOS8 because on iOS8.3 works fine the same code.

like image 38
Constantin Saulenco Avatar answered Nov 17 '22 21:11

Constantin Saulenco