【发布时间】:2019-01-04 01:49:59
【问题描述】:
与 iOS 11 相比,iOS 12 在定位服务方面是否有新的代码更改?
我有以下代码在 iOS 11 中完美运行,但在 iOS 12 中,即使它总是/在使用时要求提示,并且我看到 GPS 图标,我在我的 e 上未定义。坐标。
var hasLocationPermission = Ti.Geolocation.hasLocationPermissions(Ti.Geolocation.AUTHORIZATION_ALWAYS);
if (hasLocationPermission) {
//this just calls the function, but it the e.coords comes back as undefined in iOS 12, fine in iOS 11
getLocation();
}
function getLocation() {
Ti.Geolocation.addEventListener('location', function (e) {
try {
longitude = e.coords.longitude;
latitude = e.coords.latitude;
} catch (err) {
console.log('err', err)
}
});
}
【问题讨论】:
标签: location appcelerator ios12