iOS百度地图问题总结(三)
如果想创建以静态图片作为大头针图片的话,可以通过创建MKAnnotationView是实例。如果想使用apple自带的大头针则创建MKPinAnnotationView.
错误原因:一般是指用到的第三方框架不支持64位手机
无标题1.png
将5改为$(ARCHS_STANDARD)_32_BIT
- (void)viewDidLoad { [super viewDidLoad]; _locService = [[BMKLocationService alloc] init]; _locService.delegate = self; _mapView = [[BMKMapView alloc] initWithFrame:[UIScreen mainScreen].bounds]; if ([[UIDevice currentDevice].systemVersion doubleValue] >= 8.0) { // 主动请求权限 self.mgr = [[CLLocationManager alloc] init]; self.mgr.delegate = self; [self.mgr requestAlwaysAuthorization]; } [self.view addSubview:_mapView]; [_locService startUserLocationService]; _mapView.userTrackingMode = BMKUserTrackingModeFollow;//设置定位的状态 _mapView.showsUserLocation = YES;//显示定位图层 } /** *用户位置更新后,会调用此函数 *@param userLocation 新的用户位置 */ - (void)didUpdateBMKUserLocation:(BMKUserLocation *)userLocation{ [_mapView updateLocationData:userLocation]; if (userLocation != nil) { NSLog(@"%f %f", userLocation.location.coordinate.latitude, userLocation.location.coordinate.longitude); } }
解决办法:看看mapview的delegate是不是在viewWillAppear里面 如果是的话,viewDidLoad肯定是先于viewWillAppear被叫的,所以不会调用。