Mat*_*att 0 geolocation ios ionic-framework capacitor
我正在编写一个使用地理定位的应用程序。一切都在网络和 Android 上完美运行。但是,在 ios 上,我无法获取位置(我实现的第二种方法 - 从地图中选择一个位置虽然有效)
我在 Xcode 控制台中收到此错误:
?? To Native -> Geolocation getCurrentPosition 7620184
ERROR MESSAGE: {"errorMessage":"The operation couldn’t be completed.
(kCLErrorDomain error 0.)","message":"The operation couldn’t be completed.
(kCLErrorDomain error 0.)"}Run Code Online (Sandbox Code Playgroud)
这是我获取位置的方法:
private locateUser() {
if (!Capacitor.isPluginAvailable('Geolocation')) {
this.showErrorAlert();
return;
}
this.isLoading = true;
Plugins.Geolocation.getCurrentPosition()
.then(geoPosition => {
const coordinates: Coordinates = {
lat: geoPosition.coords.latitude,
lng: geoPosition.coords.longitude
};
this.createPlace(coordinates.lat, coordinates.lng);
this.isLoading = false;
})
.catch(err => {
this.isLoading = false;
this.showErrorAlert();
});
}Run Code Online (Sandbox Code Playgroud)
你知道什么可能导致这种情况吗?
| 归档时间: |
|
| 查看次数: |
783 次 |
| 最近记录: |