{ "id": "61550", "key": "TIMOB-918", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11224", "name": "Release 1.4.0", "archived": true, "released": true, "releaseDate": "2010-07-16" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:54:39.000+0000", "created": "2011-04-15T02:39:10.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "annotations", "map", "maps" ], "versions": [], "issuelinks": [], "assignee": { "name": "rseagraves", "key": "rseagraves", "displayName": "Reggie Seagraves", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:54:39.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}

I've been struggling to get MapView.addAnnotation working and\nnow I'm pretty sure it's buggy. If I call addAnnotation immediately\nafter creating the mapview it doesn't work, but if I instead call\nit from inside a click event listener for a button it works\nfine!

\n

Here's how to reproduce the bug in Kitchen Sink's\nmap_view.js:
\n1. In the mapview's creation, remove the atlanta annotation from\nthe annotations array
\n2. Run the app and note that the annotation is now gone
\n3. Add \"mapview.addAnnotation(atlanta);\" immediately after the\nmapview creation
\n4. Run the app and note that the annotation is still gone
\n5. Find the atl button's event listener and replace its callback's\ncontents with that addAnnotation call
\n6. Run the app, click the ATL button and note that inexplicably,\nthe annotation now shows!

\n

I'm using Mac OS 10.5, iPhone OS 3.1.3, Titanium Mobile 1.2.1,\nand Titanium SDK 1.2.0.

{html}", "attachment": [], "flagged": false, "summary": "MapView.addAnnotation not working outside callbacks", "creator": { "name": "matthewlieder", "key": "matthewlieder", "displayName": "Matthew Lieder", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "matthewlieder", "key": "matthewlieder", "displayName": "Matthew Lieder", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "124337", "author": { "name": "matthewlieder", "key": "matthewlieder", "displayName": "Matthew Lieder", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Sadly still a problem using Titanium SDK 1.3.0

{html}", "updateAuthor": { "name": "matthewlieder", "key": "matthewlieder", "displayName": "Matthew Lieder", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:39:11.000+0000", "updated": "2011-04-15T02:39:11.000+0000" }, { "id": "124338", "author": { "name": "matthewlieder", "key": "matthewlieder", "displayName": "Matthew Lieder", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Assigning to a developer to make sure this issue doesn't get\nmissed. Stephen, I apologize if you're not the appropriate\ndeveloper; I did my best guess.

{html}", "updateAuthor": { "name": "matthewlieder", "key": "matthewlieder", "displayName": "Matthew Lieder", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:39:11.000+0000", "updated": "2011-04-15T02:39:11.000+0000" }, { "id": "124339", "author": { "name": "yeggeps", "key": "yeggeps", "displayName": "Yeggeps", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I, too, have come across this problem. The same seems to apply\nto selectAnnotation.
\nIf I call it outside an Eventlistener, nothing happens, but works\nfine in a button.
\nI also tried to use it within a focus event listener on the mapview\nand the window that contains the mapview, no success.

\n

like this

\n
\nwin_map.addEventListener('focus',function(){\n    mapview.selectAnnotation(name,true);\n});\n\nmapview.addEventListener('focus',function(){\n    mapview.selectAnnotation(name,true);\n});\n
{html}", "updateAuthor": { "name": "yeggeps", "key": "yeggeps", "displayName": "Yeggeps", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:39:12.000+0000", "updated": "2011-04-15T02:39:12.000+0000" }, { "id": "124340", "author": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [64e7b513f714f82b2dafe91694ec43656dc365bb])\nCloses #918: Map view functions now work before view is\ndrawn. BUT: Be aware of the documentation change. This is a\nlimitation of view drawing and the map kit combined. \nhttp://github.com/appcelerator/titanium_mobile/commit/64e7b513f714f...

{html}", "updateAuthor": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:39:12.000+0000", "updated": "2011-04-15T02:39:12.000+0000" }, { "id": "124341", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Okay, this is fixed. But PLEASE be aware of the following\nprecondition: You cannot call any methods on a map view until it\nhas been added to another view. Otherwise crashes will result.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:39:12.000+0000", "updated": "2011-04-15T02:39:12.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }