MKMapView无法在iOS 8或更高版本中渲染

Amm*_*han 15 mkmapview ios8

我在iOS 8.xx中的MKMapView中遇到问题应用程序在iOS 8.xx中运行良好但在iOS 8.xx中没有.在设备上它只显示注释但没有后面的地图.

我试图强行重置我的设备,但没有运气.

我在info.plist中添加了这两个值,这也是iOS 8及以后版本的要求

<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>
Run Code Online (Sandbox Code Playgroud)

并在我的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;
    }
Run Code Online (Sandbox Code Playgroud)

通过在info.plist和上面的代码行中添加这两个值,我可以获取用户的位置和注释,在地图上显示用户的位置,但Map是空白.

与此文章类似: MKMapView在iOS 8中显示空白屏幕

带注释的空白地图视图

小智 21

在IOS8.3上有同样的东西,无论是sim还是设备.通过运行系统地图应用程序(它也显示空网格)一分钟解决,直到它下载地图.之后,我的MKMapView开始正常渲染.

  • 我们有同样的问题,这个"补丁"也适用于我们.IMO,要求用户打开地图应用并返回到您的应用是没有意义的.任何方式"强制"地图刷新和/或地图下载?谢谢. (2认同)