iOS一次定位和多次定位都失败
上周使用的还是iOS1.0.0SDK的一次定位,而且正常,这周突然发现定位出了问题,检查获取到的地理位置为空,错误信息是:Error Domain=AMapLocationErrorDomain Code=5 "取消" UserInfo={NSLocalizedDescription=取消}更改为多次定位后
1.- (void)amapLocationManager:(AMapLocationManager *)manager didFailWithError:(NSError *)error;
2.- (void)amapLocationManager:(AMapLocationManager *)manager didUpdateLocation:(CLLocation *)location;
这两个代理方法都没走
你设置代理了吗?没设置self,怎么可能走代理方法。
设置代理了吗? 也遇到同样的问题,单次定位提示error为取消,但在使用delegate多次定位,有写delegate,没有回调。 不要搞成局部局部变量,亲~
AMapLocationManager被释放的时候,自然会cancel掉~ 发帖都发不了 只能插楼了!!!!
关闭定位无效 v3.3.0
self.mapView.showsUserLocation = NO;没有作用
在两个界面都显示了地图设置无效
至于sdk版本 我是直接pod安装的 没有写版本号,所以就是最新的版本
部分代码:
@property (nonatomic,weak) MAMapView * mapView;//地图
-(MAMapView *)mapView{
if (!_mapView) {
MAMapView * mapview = [initWithFrame:self.view.bounds];
mapview.delegate = self;
mapview.showsScale = NO;
_mapView.showsUserLocation = YES;
_mapView.userTrackingMode = MAUserTrackingModeNone;
_mapView = mapview;
_mapView.zoomLevel = 19;
_mapView.showsCompass = NO;
}
return _mapView;
}
在定位中 关闭无效
-(void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation
updatingLocation:(BOOL)updatingLocation
{
if(updatingLocation)
{
self.mapView.centerCoordinate = self.mapView.userLocation.location.coordinate;
//取出当前位置的坐标
NSLog(@"当前位置:latitude : %f,longitude: %f",userLocation.coordinate.latitude,userLocation.coordinate.longitude);
CLLocation * cll = [ initWithLatitude:self.mapView.userLocation.location.coordinate.latitude longitude:self.mapView.userLocation.location.coordinate.longitude];
CLGeocoder *clGeoCoder = [ init];
[clGeoCoder reverseGeocodeLocation:cll completionHandler: ^(NSArray *placemarks,NSError *error) {
CLPlacemark *placeMark = ;
NSDictionary *addressDic=placeMark.addressDictionary;
// NSString *state=;//省
self.city =;//市
// NSString *subLocality=;//区
// NSString *street=;//街道
self.mapView.showsUserLocation = NO;
}];
}
}
望解决!!!没辙了 不然也不会这个点发!!!!!
定位结束以后 断点试一下self.mapView.showsUserLocation = NO;有调用么?
楼主, 问题解决了吗., 我的一次定位, 第一次定位成功, 后来的同样的代码都没有成功 请问大神怎样才能手机号码基站定位?
页:
[1]