【发布时间】:2018-10-22 07:10:30
【问题描述】:
我有一个使用位置服务的应用,但是当我请求当前位置并且在用户允许后,应用找不到位置。 为了让用户找到它的位置,必须关闭并重新打开应用程序,直到找到正确的位置。 这是我的代码:
componentWillMount() {
this.getCurrentLocation();
}
getCurrentLocation = () => {
const locationConfig = {
timeout: 20000,
maximumAge: 1000,
enableHighAccuracy: false
};
navigator.geolocation.getCurrentPosition(
this.iGetLocation,
(error) => {
console.log(error);
},
locationConfig
);
};
【问题讨论】: