[TIMOB-7921] iOS: Opening an email dialog from a CommonJS module will cause a 'Invalid type passed to function' error
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2017-06-12T19:18:59.000+0000 |
Affected Version/s | Release 1.8.2 |
Fix Version/s | n/a |
Components | iOS |
Labels | core |
Reporter | Quoc Huy |
Assignee | Eric Merriman |
Created | 2012-03-07T10:56:56.000+0000 |
Updated | 2017-06-12T19:18:59.000+0000 |
Description
Here is the structure of my app (all modules are loaded with CommonJS require):
* app.js is loading a modules/core.js module, which then loads modules/tabs.js
* modules/core.js holds main properties and methods of the app
* modules/tabs.js will create the tabGroup, each tab will then load its tab module (modules/pages/TabContact.js) for example.
* modules/pages/TabContact.js will create a table view in which one of the row should trigger the creation of a emailDialog
The bug I've found is:
* 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
* but if instead I load another module which in turn create the email dialog and open it I will get the error message below.
Error message:
[ERROR] Invalid type passed to function. expected: NSArray or nil, was: __NSCFString in -[TiUIEmailDialogProxy open:] (TiUIEmailDialogProxy.m:64)
[WARN] Exception in event callback. {
line = 22;
message = "Invalid type passed to function. expected: NSArray or nil, was: __NSCFString in -[TiUIEmailDialogProxy open:] (TiUIEmailDialogProxy.m:64)";
sourceId = 164551848;
sourceURL = "";
}
modules/emailBuilder.js
exports.buildEmailView = function(to, subject, defaultBody) {
var emailDialog = Ti.UI.createEmailDialog();
emailDialog.setSubject(subject);
emailDialog.setToRecipients(to);
emailDialog.setMessageBody(defaultBody);
emailDialog.setHtml(true);
emailDialog.setBarColor('#312f2c');
emailDialog.addEventListener('complete',function(e)
{
if (e.result == emailDialog.SENT)
{
alert("message was sent");
}
else
{
alert("message was not sent. result = "+e.result);
}
});
emailDialog.open(); // This is line 22
}
Closing ticket due to the time passed, lack of information and lack of progress. Any problems, please file a new ticket.