首页 > 解决方案 > 我在使用 react-native-geolocation-service 时得到 [TypeError: null is not an object (evalating 'RNFusedLocation.getCurrentPosition')]

问题描述

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

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},
          );

标签: reactjsreact-nativegeolocation

解决方案


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

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

感谢您的回答


推荐阅读