1,首先选中Build Phases ,在Link Binary With Libraries 下添加MapKit.framework框架
2,在头文件(.h文件)处添加:#import <MapKit/MapKit.h>
3,如果需要定位到你当前的位置,该类还需要遵循 :<MKMapViewDelegate>
4,声明MKMapView对象:
MKMapView *mapView = [[MKMapViewalloc]initWithFrame:[UIScreenmainScreen].applicationFrame];
mapView.showsUserLocation = YES;
mapView.mapType = MKMapTypeStandard;
[view addSubview:mapView];