關(guān)于導(dǎo)入百度地圖SDK出現(xiàn)的問題(一)
原帖地址
1.MKAnnotationView和MKPinAnnotationView的區(qū)別.
如果想創(chuàng)建以靜態(tài)圖片作為大頭針圖片的話,可以通過創(chuàng)建MKAnnotationView是實例。如果想使用apple自帶的大頭針則創(chuàng)建MKPinAnnotationView.
2.Undefined symbols for architecture x86_64
錯誤原因:一般是指用到的第三方框架不支持64位手機

無標(biāo)題1.png
將5改為$(ARCHS_STANDARD)_32_BIT
3. Terminating app due to uncaught exception ‘NSInvalidUnarchiveOperationException’,reason ‘Could not instantiate class named MKMapView’ 解決辦法:如果sotoryboard中用到了地圖,必須手動導(dǎo)入框架MapKit.framework.
4.使用百度地圖api不顯示當(dāng)前位置的藍點,如下代碼
- (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) {
// 主動請求權(quán)限
self.mgr = [[CLLocationManager alloc] init];
self.mgr.delegate = self;
[self.mgr requestAlwaysAuthorization];
}
[self.view addSubview:_mapView];
[_locService startUserLocationService]; _mapView.userTrackingMode = BMKUserTrackingModeFollow;//設(shè)置定位的狀態(tài)
_mapView.showsUserLocation = YES;//顯示定位圖層
}
/**
*用戶位置更新后,會調(diào)用此函數(shù)
*@param userLocation 新的用戶位置
*/
- (void)didUpdateBMKUserLocation:(BMKUserLocation *)userLocation{
[_mapView updateLocationData:userLocation];
if (userLocation != nil) {
NSLog(@"%f %f", userLocation.location.coordinate.latitude, userLocation.location.coordinate.longitude);
}
}
5.百度地圖BMKMapViewDelegate的-mapView:viewForAnnotation:函數(shù)不調(diào)用
解決辦法:看看mapview的delegate是不是在viewWillAppear里面 如果是的話,viewDidLoad肯定是先于viewWillAppear被叫的,所以不會調(diào)用。