私は Objective C の初心者です。Navigation コントローラ内で TableRow を選択した後、Mapview を設定しています。アプリケーションを終了するこのエラーが発生しています。
-[UIView setRegion:animated:]: unrecognized selector sent to instance 0x806b2c0
これはMapviewの私のviewWillAppeerです
- (void)viewWillAppear:(BOOL)animated {
CLLocationCoordinate2D zoomLocation;
zoomLocation.latitude = 39.281516;
zoomLocation.longitude= -76.580806;
if (CLLocationCoordinate2DIsValid(location)) {
MKCoordinateRegion mapRegion = MKCoordinateRegionMakeWithDistance(zoomLocation, 0.5*METERS_PER_MILE, 0.5*METERS_PER_MILE);
[_mapView setRegion:mapRegion animated:YES];
} else {
NSLog(@"Invalid coordinates");
}
}
これのヘッダー ファイルは mapkit と corelocation をインポートし、このプロパティを持ちます。
@property (weak, nonatomic) IBOutlet MKMapView *mapView;
ヘッダー ファイルには mapkit と coreelocation が含まれており、このプロパティを強力にしても何も変わりませんでした。