这是我的大问题。添加“Assetlibrary.Framwork”时,我的 mapView 运行时出现错误。如果我删除库,我的 mapView 就可以了。为什么?这是我的地图视图代码:(ps我正在使用情节提要)
.h
@property (strong, nonatomic) IBOutlet MKMapView *MapView;
.m
viewdidload:
MapView.delegate = self;
[self setLocationManager:[[CLLocationManager alloc] init]];
[locationManager setDelegate:self];
[locationManager setDistanceFilter:kCLDistanceFilterNone];
[locationManager setDesiredAccuracy:kCLLocationAccuracyHundredMeters];
[locationManager startUpdatingLocation];
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
if ((oldLocation.coordinate.longitude != newLocation.coordinate.longitude)
|| (oldLocation.coordinate.latitude != newLocation.coordinate.latitude)) {
coord.latitude = newLocation.coordinate.latitude;
coord.longitude = newLocation.coordinate.longitude;
region.center = coord;
span.latitudeDelta = 0.05;
span.longitudeDelta = 0.05;
region.span = span;
}
这是我的错误:
'NSUnknownKeyException',原因:'[setValue:forUndefinedKey:]:此类不符合键 MapView 的键值编码。
我是否设置了两次地图视图?还是我做错了什么?