钛:Ti.Map未定义

  • 本文关键字:未定义 Map Ti titanium
  • 更新时间 :
  • 英文 :


我想我必须做一个更新,因为我的应用程序停止工作。

这行很简单:

var marker = Ti.Map.createAnnotation({
    latitude: json.objects[0].tour[e.index].locations[i].latitude,
    longitude: json.objects[0].tour[e.index].locations[i].longitude,
    title: json.objects[0].tour[e.index].locations[i].name,
    subtitle: json.objects[0].tour[e.index].locations[i].excerpt,
    animate: true,
    pincolor: Ti.Map.ANNOTATION_GREEN,
    leftButton: '../images/pointer.png',
    image: '../images/pointer.png'
});

但是当我试图编译时,我得到:

'undefined'不是对象(求值'Ti.Map.createAnnotation')

我添加了Ti.Map作为一个手表表达式,它说它是未定义的?

我做错了什么?

Ti.Map在3.2.0中被删除。查看Appcelerator的弃用说明(链接如下)以了解更多信息。

http://docs.appcelerator.com/titanium/3.0/# !/api/Titanium.Map

基本上,你现在想要的是:

var Map = require('ti.map'),
    annotation = Map.createAnnotation({ ... }),
    mapView = Map.createView({ ... });

该模块的文档在这里:

http://docs.appcelerator.com/titanium/3.0/# !/api/Modules.Map

最新更新