【问题标题】:Issue in Titanium AppceleratorTitanium Appcelerator 中的问题
【发布时间】:2013-01-29 11:07:49
【问题描述】:
我正在尝试导入一个项目并将其运行到 Appcelerator 上的 iPhone 模拟器上,但我在控制台上收到一条消息,提示:
[WARN] : The Ti.Geolocation.purpose property must be set.
[INFO] : {"source":{"cache":false},"type":"error"}
我花了 2 个多小时试图消除这个问题。
另外,请分享有关 appcelerator 应用生命周期的有用资源。
【问题讨论】:
标签:
appcelerator
titanium-mobile
appcelerator-mobile
titanium-modules
【解决方案1】:
它说“必须设置 Ti.Geolocation. purpose 属性。”
我会尝试类似的东西
Ti.Geolocation.purpose = "Find restaurants near you";
iOS 想让用户知道你的应用为什么想知道他的位置。用户必须允许此地理位置权限。这就是为什么你应该用 if 语句包围你的位置请求:
if (Titanium.Geolocation.locationServicesEnabled){
Titanium.Geolocation.getCurrentPosition(function(e){
Ti.API.info(e.coords);
}
}else{
Titanium.UI.createAlertDialog({title:'Location Service', message:'Please turn on your location services.'}).show();
}