Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15850] iOS7: Map: Runtime error while creating Ti.Map.createView method

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2013-12-02T18:47:42.000+0000
Affected Version/sRelease 3.2.0
Fix Version/sn/a
ComponentsiOS
Labelsqe-3.2.0
ReporterParas Mishra
AssigneeIngo Muschenetz
Created2013-11-29T09:44:51.000+0000
Updated2013-12-02T18:52:20.000+0000

Description

iOS7: Map: Runtime error while creating Ti.Map.createView method Issue also exist on SDK: 3.1.3.GA using xcode v5 Steps to reproduce: 1.Run the app below.
var win = Ti.UI.currentWindow,
    mapView = Ti.Map.createView({
        mapType: Ti.Map.STANDARD_TYPE,
        height: 150,
        top:0,
        regionFit:true,
        userLocation:true,
        annotations:[]
    }),
    resizeBtn = Ti.UI.createButton({
        title:"resize map",
        width:100,
        height:44,
        right:5,
        bottom:5
    }),
    mapToggle = false;

    if (Ti.Platform.osname === "iphone" || Ti.Platform.osname === "ipad") {
        mapView.animate = true;
    }
    mapView.add(resizeBtn);
    win.add(mapView);

    resizeBtn.addEventListener("click", function(){
        mapToggle = !mapToggle;
        if(mapToggle){
            mapView.animate({height:250, duration:300});
        } else {
            mapView.animate({height:150, duration:300});
        }
    });
    win.open();

Expected: You should see a world map. Actual: Runtime error occurs as " Nov 29 15:09:16 Globals-iPhone-5s test[362] : [ERROR] Script Error { backtrace = "#0 () at :0"; line = 1; message = "'undefined' is not an object (evaluating 'Ti.Map.createView')"; name = TypeError; sourceId = 48064800; sourceURL = "file:///var/mobile/Applications/9BBC5C5D-3DD9-470C-B9C9-1415003F0B11/test.app/app.js"; } "

Comments

  1. Wilson Luu 2013-12-02

    Closing ticket as invalid. Ti.Map has been deprecated for SDK 3.2.0 and needs to require in ti.map module (http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Map). Here is the positive test case I used to get it working after requiring in the ti.map module:
       var Map = require('ti.map');
       
       // var win = Ti.UI.currentWindow,
       
       var win = Ti.UI.createWindow({
       	backgroundColor:'white'
       }), 
       
       mapView = Map.createView({
       	mapType : Map.STANDARD_TYPE,
       	height : 150,
       	top : 0,
       	regionFit : true,
       	userLocation : true,
       	annotations : []
       }), 
       
       resizeBtn = Ti.UI.createButton({
       	title : "resize map",
       	width : 100,
       	height : 44,
       	right : 5,
       	bottom : 5
       }), mapToggle = false;
       
       if (Ti.Platform.osname === "iphone" || Ti.Platform.osname === "ipad") {
       	mapView.animate = true;
       }
       mapView.add(resizeBtn);
       win.add(mapView);
       
       resizeBtn.addEventListener("click", function() {
       	mapToggle = !mapToggle;
       	if (mapToggle) {
       		mapView.animate({
       			height : 250,
       			duration : 300
       		});
       	} else {
       		mapView.animate({
       			height : 150,
       			duration : 300
       		});
       	}
       });
       win.open(); 
       
    Tested on: Titanium Studio, build: 3.2.0.201311262027 SDK build: 3.2.0.v20131127194046 CLI: 3.2.0-beta Alloy: 1.3.0-beta Xcode: 5.0.2 Device: iphone 5 (7.0.2)
  2. Wilson Luu 2013-12-02

    Reopening ticket to update which test environment I used.

JSON Source