react-native-amap-geolocation icon indicating copy to clipboard operation
react-native-amap-geolocation copied to clipboard

ios 无反应

Open tanjwGit opened this issue 5 years ago • 4 comments

您好,当我按照文档配置好之后,安卓正常得到了位置信息,但ios并不能得到位置信息或者报错信息,甚至iOS系统定位权限弹窗都没有

重现环境

  1. reactnative 0.61.5
  2. ios模拟器 11 系统版本13.3
  3. ipad pro10.5 系统版本13.3

现象:

    console.log('开始定位');
    Geolocation.getCurrentPosition(
      ({coords})=>{console.log('成功', coords);},
      (err)=>{console.log('失败', err);}
    );

输出:

开始定位

tanjwGit avatar Feb 07 '20 08:02 tanjwGit

xcode版本 11

tanjwGit avatar Feb 07 '20 08:02 tanjwGit

  • (void)amapLocationManager:(AMapLocationManager )manager doRequireLocationAuth:(CLLocationManager)locationManager { [locationManager requestAlwaysAuthorization]; }

加一段这个

DaiYz avatar Mar 19 '20 09:03 DaiYz

+1 我也遇到同样的问题 @DaiYz 能详细说明一下步骤嘛 感谢

我发现源码中加入了楼上所说的doRequireLocationAuth这个回调,但我从npm上获取到的包并没有这个方法。

ZhangTaoK avatar Apr 03 '20 07:04 ZhangTaoK

在AMapGeolocation.m文件114行加入这块代码,来使app申请定位权限,才能拿到定位信息

- (void)amapLocationManager:(AMapLocationManager *)manager doRequireLocationAuth:(CLLocationManager *)locationManager{ [locationManager requestAlwaysAuthorization]; }

Geek-ch avatar Apr 28 '20 09:04 Geek-ch