{ "id": "87501", "key": "TIMOB-7921", "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": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2017-06-12T19:18:59.000+0000", "created": "2012-03-07T10:56:56.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "core" ], "versions": [ { "id": "13070", "description": "Release 1.8 Service Pack 2", "name": "Release 1.8.2", "archived": true, "released": true, "releaseDate": "2012-02-29" } ], "issuelinks": [], "assignee": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-06-12T19:18:59.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": "Here is the structure of my app (all modules are loaded with CommonJS require):\r\n* app.js is loading a modules/core.js module, which then loads modules/tabs.js\r\n* modules/core.js holds main properties and methods of the app\r\n* modules/tabs.js will create the tabGroup, each tab will then load its tab module (modules/pages/TabContact.js) for example.\r\n* modules/pages/TabContact.js will create a table view in which one of the row should trigger the creation of a emailDialog\r\n\r\nThe bug I've found is:\r\n* if I var emailDialog = Ti.UI.createEmailDialog() ... emailDialog.open() within the tableview.addEventListener('click', function(e) {...} then all is fine, my email dialog shows up\r\n* but if instead I load another module which in turn create the email dialog and open it I will get the error message below.\r\n\r\nError message:\r\n{code}\r\n[ERROR] Invalid type passed to function. expected: NSArray or nil, was: __NSCFString in -[TiUIEmailDialogProxy open:] (TiUIEmailDialogProxy.m:64)\r\n[WARN] Exception in event callback. {\r\n line = 22;\r\n message = \"Invalid type passed to function. expected: NSArray or nil, was: __NSCFString in -[TiUIEmailDialogProxy open:] (TiUIEmailDialogProxy.m:64)\";\r\n sourceId = 164551848;\r\n sourceURL = \"\";\r\n}\r\n{code}\r\n\r\nmodules/emailBuilder.js\r\n{code:javascript}\r\nexports.buildEmailView = function(to, subject, defaultBody) {\r\n\r\n\tvar emailDialog = Ti.UI.createEmailDialog();\r\n\temailDialog.setSubject(subject);\r\n\temailDialog.setToRecipients(to);\r\n\temailDialog.setMessageBody(defaultBody);\r\n\temailDialog.setHtml(true);\r\n\temailDialog.setBarColor('#312f2c');\r\n\r\n\temailDialog.addEventListener('complete',function(e)\r\n\t{\r\n\t\tif (e.result == emailDialog.SENT)\r\n\t\t{\r\n\t\t\talert(\"message was sent\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\talert(\"message was not sent. result = \"+e.result);\r\n\t\t}\r\n\t});\r\n\r\n\temailDialog.open(); // This is line 22\r\n}\r\n{code}\r\n\r\n", "attachment": [], "flagged": false, "summary": "iOS: Opening an email dialog from a CommonJS module will cause a 'Invalid type passed to function' error", "creator": { "name": "quochuy", "key": "quochuy", "displayName": "Quoc Huy", "active": true, "timeZone": "Australia/Sydney" }, "subtasks": [], "reporter": { "name": "quochuy", "key": "quochuy", "displayName": "Quoc Huy", "active": true, "timeZone": "Australia/Sydney" }, "environment": "Mac OS X Lion 10.7.3\r\nXcode 4.3\r\nTi SDK 1.8.2", "comment": { "comments": [ { "id": "421781", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket due to the time passed, lack of information and lack of progress. Any problems, please file a new ticket.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-06-12T19:18:59.000+0000", "updated": "2017-06-12T19:18:59.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }