1,添加过BMKMapView之后后面的代码不执行
[self addSubview:self.mapView];
//下面的代码不执行
[self.mapView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
原因:需要在AppDelegate的application:didFinishLaunchingWithOptions:的方法中鉴权
// 要使用百度地图,请先启动BaiduMapManager
BMKMapManager *mapManager = [[BMKMapManager alloc] init];
// 如果要关注网络及授权验证事件,请设定generalDelegate参数
BOOL ret = [mapManager start:@"百度地图key" generalDelegate:nil];
if (!ret) {
NSLog(@"启动引擎失败");
}
2,地图只显示网格,不显示内容
a. 首先百度地图key和Bundle Identifier要和百度平台上配置的AK和安全码一致(区分大小写)
b。工程里 .plist文件里要添加Bundle display name
3,报错:locError:{7 - 鉴权失败导致无法返回定位、地址等信息};
原因:需要在AppDelegate的application:didFinishLaunchingWithOptions:的方法中初始化定位SDK
// 初始化定位SDK
[[BMKLocationAuth sharedInstance] checkPermisionWithKey:@"百度地图key" authDelegate:self];
4,BMKPoiSearchDelegate代理方法不调用
- (void)onGetPoiResult:(BMKPoiSearch*)searcher result:(BMKPOISearchResult*)poiResult errorCode:(BMKSearchErrorCode)errorCode {
}
原因:poiSearchNearBy: 方法的参数BMKPOINearbySearchOption的location属性未设置合适的值。