【问题标题】:im getting [TypeError: null is not an object (evaluating 'RNFusedLocation.getCurrentPosition')] when using react-native-geolocation-service我在使用 react-native-geolocation-service 时得到 [TypeError: null is not an object (evalating 'RNFusedLocation.getCurrentPosition')]
【发布时间】:2021-02-19 13:48:34
【问题描述】:

尝试使用 react-native-geolocation-service 并按照提供的设置进行操作,但仍然出现错误。 我正在使用:

  • react-native": "0.63.4,
  • react-native-geolocation-service": "^5.2.0
import Geolocation from 'react-native-geolocation-service';

         Geolocation.getCurrentPosition(
            (position) => {
              console.log(position);
            },
            (error) => {
              console.log(error.code, error.message);
            },
            {enableHighAccuracy: false, timeout: 10000, maximumAge: 100000},
          );

【问题讨论】:

    标签: reactjs react-native geolocation


    【解决方案1】:

    我认为是我的错,我通过重建修复了它

    cd android
    ./gradlew clean
    ./gradlew cleanBuildCache
    cd ../
    
    

    感谢您的回答

    【讨论】:

      【解决方案2】:

      我是巴西人,因此我会说葡萄牙语,但我会使用翻译来帮助您。

      你可以做的是:

      getCurrentPosition 方法报错,这个错误可能没有 .code.message。我建议在尝试获取您的信息之前提供console.log (error)

      【讨论】:

      • 我仍然遇到同样的错误,我读到这可能是一个设置问题,但我按照他们的设置过程进行了操作
      猜你喜欢
      • 2022-11-01
      • 1970-01-01
      • 2016-07-30
      • 2020-08-31
      • 2020-04-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-03
      相关资源
      最近更新 更多