我在iOS 8.x.x中的MKMapView中遇到问题.应用程序工作正常iOS 7.x.x,但不在iOS 8.x.x中.在设备上,它只显示注释,但没有映射.
我试图强制重置我的设备,但没有运气.
我在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>
并在我的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; }
通过在info.plist和上述代码行中添加这两个值,我可以在用户位置的地图上显示用户的位置和注释,但Map是Blank.
解决方法
在IOS8.3上都有相同的东西,包括sim和设备. 通过运行系统Maps App(它也显示空网格)解决了一分钟,直到它下载地图.之后,我的MKMapView开始渲染正常.