最近接手的项目用到百度地图,在跳转带有百度地图的控制器时会出现莫名其妙的状态: push不过去。
检查了良久,以为没有开启百度地图,然后又调用了
[self.locationService startUserLocationService];
结果还是不行,后来发现BMKRouteSearch初始化不成功
self.routesearch = [[BMKRouteSearch alloc]init];
或者BMKMapView初始化不成功
self.mapView = [[BMKMapView alloc] init];
初始化不成功,每次都卡初始化在这里。
查看了百度地图的例子把在delegate里面初始化BMKMapManager
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
_mapManager = [[BMKMapManager alloc]init];
BOOL ret = [_mapManager start:@"你的百度appkey" generalDelegate:self];
if (!ret) {
KTLogDebug(@"manager start failed!");
}
return YES;
}