使用mapbox和Nativescript查找用户位置
老实说,我仍然很难理解如何使用Nativescript调用本机iosapi。我已经阅读了一些关于如何为Nativescript构建插件的简短教程,但我想需要一些Objective-C或Android方面的知识。 我想使用EddyVerbruggen/nativescript mapbox插件将地图居中到用户位置,因为我找不到任何返回用户坐标的方法,所以我尝试模拟此插件的结构来添加一个新方法: 关于mapbox.d.ts使用mapbox和Nativescript查找用户位置,nativescript,Nativescript,老实说,我仍然很难理解如何使用Nativescript调用本机iosapi。我已经阅读了一些关于如何为Nativescript构建插件的简短教程,但我想需要一些Objective-C或Android方面的知识。 我想使用EddyVerbruggen/nativescript mapbox插件将地图居中到用户位置,因为我找不到任何返回用户坐标的方法,所以我尝试模拟此插件的结构来添加一个新方法: 关于mapbox.d.ts export function findUserPosition(): Pr
export function findUserPosition(): Promise<any>;
关于map-view-model.js
DemoAppModel.prototype.findUserPosition = function(){
mapbox.findUserPosition().then(function(result){
console.log(result)
},function(error){
console.log(error)
})
};
如果您想在应用程序中获取用户位置,您可以使用
nativescript geology
-插件或nativescript谷歌地图sdk
。@NikolayTsonev nativescript geology插件这是个好主意,我会尝试一下。谢谢
DemoAppModel.prototype.findUserPosition = function(){
mapbox.findUserPosition().then(function(result){
console.log(result)
},function(error){
console.log(error)
})
};