Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-native 0.66.4 ios运行出现错误 #145

Open
QMY-ZQ opened this issue Jan 18, 2022 · 5 comments
Open

react-native 0.66.4 ios运行出现错误 #145

QMY-ZQ opened this issue Jan 18, 2022 · 5 comments
Labels
bug Something isn't working ios Only for ios

Comments

@QMY-ZQ
Copy link

QMY-ZQ commented Jan 18, 2022

我按照官网,添加相应的两个framework文件。然后运行的是,ios弹出位置信息获取的弹窗,点确定,xcode 中的。main.m文件出现以下错误
WechatIMG38

然后我发现是依赖里面**setLocatingWithReGeocode(true)**这个方法问题,注释掉就可以了,但是经纬度拿不到,
如图
image
不知道各位有遇到了吗?

@QMY-ZQ QMY-ZQ added bug Something isn't working ios Only for ios labels Jan 18, 2022
@Golden88888888
Copy link

ios 里面AMapGeolocation.m里面注释调一段代码就好了,然后就能返回带省市区名称的reGeocode了

// 去掉这个的原因在于AMAP由于不知名原因返回的error为空,导致闪退

  • (void)amapLocationManager:(AMapLocationManager *)manager
    didFailWithError:(NSError *)error {
    // [self sendEventWithName:@"AMapGeolocation"
    // body:@{
    // @"errorCode" : @(error.code),
    // @"errorInfo" : error.localizedDescription,
    // }];
    }

image

@Golden88888888
Copy link

如果不去掉这段代码,setLocatingWithReGeocode的时候,会抛异常,而这个异常的error居然为nil,从而导致整个app闪退

@Golden88888888
Copy link

setLocatingWithReGeocode(true) 这个方法没有问题,按上面步骤注释调那段代码以后,就能拿到全部信息了

@QMY-ZQ
Copy link
Author

QMY-ZQ commented Jan 22, 2022

@Golden88888888 谢谢提供解决方案,我明天来解决一下。。。

@tvsj
Copy link

tvsj commented May 4, 2023

ios 里面AMapGeolocation.m里面注释调一段代码就好了,然后就能返回带省市区名称的reGeocode了

// 去掉这个的原因在于AMAP由于不知名原因返回的error为空,导致闪退

  • (void)amapLocationManager:(AMapLocationManager *)manager
    didFailWithError:(NSError *)error {
    // [self sendEventWithName:@"AMapGeolocation"
    // body:@{
    // @"errorCode" : @(error.code),
    // @"errorInfo" : error.localizedDescription,
    // }];
    }

非常感谢!这个问题花了我一整天。。。太难了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ios Only for ios
Projects
None yet
Development

No branches or pull requests

3 participants