在Phonegap-2.3.0中调用EmailComposerwithattachments插件时出现“FAILED pluginJSON”错误

时间:2013-02-21 09:18:26

标签: xcode cordova ios6 phonegap-plugins

您好我正在使用来自phonegap插件的EmailcomposerWithAttachments插件。我正在使用Phonegap-2.3.0和ios6 Simulator以及最新的Xcode。

我已将.m,.h文件放在项目的Plugins文件夹中,将Js文件放在WWW文件夹中并使用

调用插件
window.plugins.emailComposer.showEmailComposer("Look at this photo","Take a look at <b>this<b/>:",["the.das@gmail.com", "dasthe@gmail.com"],[],[],true,[]);

在readme.md文件中给出的js代码。 https://github.com/phonegap/phonegap-plugins/tree/master/iOS/EmailComposerWithAttachments

当我运行它时,我在Log中遇到错误。

-[CDVCommandQueue executePending] [Line 103] FAILED pluginJSON = ["INVALID","EmailComposer","showEmailComposer",[{"subject":"Look at this photo","bIsHTML":true,"ccRecipients":[],"attachments":[],"bccRecipients":[],"toRecipients":["the.das@gmail.com","dasthe@gmail.com"],"body":"Take a look at <b>this<b/>:"}]]

请告诉我我在做错的地方。

在config.xml文件<plugin name="EmailComposer" value="EmailComposer" />中我将其添加到plugIn

感谢。

2 个答案:

答案 0 :(得分:0)

您的插件似乎已正确添加,但插件文件中出现了一些错误。我想你可以在xcode中创建另一个项目并编译以检查插件中是否存在bug。

答案 1 :(得分:0)

尝试使用&#34;&#34;而不是像这样的[]

window.plugins.emailComposer.showEmailComposer(
"Look at this photo", // subject
"Take a look at <b>this<b/>:", // body
"the.das@gmail.com,dasthe@gmail.com", // toRecipients
"", // toRecipients
"", // bccRecipients
true, // bIsHTML
);

在代码中,我们希望字符串是分开的,然后是@&#34;,&#34;

...
[picker setToRecipients:[ toRecipientsString componentsSeparatedByString:@","]];
...

我希望这会有所帮助