当我致电geolocation进行currentlocation。我面临这样的错误

时间:2019-02-14 11:24:40

标签: angularjs ionic3

当我将geolocation称为currentlocation时,我面临这样的错误

 TypeError: Object(...) is not a function
 at Geolocation.getCurrentPosition 

import { Geolocation } from '@ionic-native/geolocation/ngx';
     constructor(public geolocation:Geolocation ){}
    this.geolocation.getCurrentPosition().then((resp) => {
     // resp.coords.latitude
     // resp.coords.longitude
    }).catch((error) => {
      console.log('Error getting location', error);
    });

1 个答案:

答案 0 :(得分:0)

我试图整理代码,因为我认为代码中存在问题

describe

如果这不起作用,您可以看到此https://forum.ionicframework.com/t/geolocation-issues/157072/7

另外,您可以在此处查看该教程 https://github.com/apache/cordova-plugin-geolocation#coords