0

我正在尝试导入一个项目并将其运行到 Appcelerator 上的 iPhone 模拟器上,但我在控制台上收到一条消息,上面写着:

 [WARN] :  The Ti.Geolocation.purpose property must be set.
        [INFO] :  {"source":{"cache":false},"type":"error"}

我花了两个多小时试图消除这个问题。另外,请分享有关 appcelerator 应用程序生命周期的有用资源。

4

2 回答 2

2

它说“必须设置 Ti.Geolocation. purpose 属性。” 我会尝试类似的东西

Ti.Geolocation.purpose = "Find restaurants near you";

iOS 想让用户知道为什么你的 App 想知道他的位置。用户必须允许此地理位置权限。这就是为什么你应该用 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();
}
于 2013-01-29T16:35:47.193 回答
0

要发送到呼叫的参数是错误的。

于 2013-01-29T12:09:41.767 回答