问题描述
我已经构建了一个简单的基于jQuery Mobile的应用程序,并尝试使用Phonegap编译它。
我希望用户能够通过电子邮件从应用程序发送一些内容,但我不能明白这一点。
I've built a simple jQuery Mobile based app, and trying to compile it with Phonegap.I'd like the users to be able to send some content from the app via email, but I can't figure this out.
我的代码:
<script type="text/javascript" src="json2.js"></script>
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script type="text/javascript" src="EmailComposer.js"></script>
<script src="js/jquery-1.5.min.js"></script>
<script src="js/jquery.mobile-1.0a3.min.js"></script>
<script src="js/jsStuff.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for PhoneGap to load
//
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
// PhoneGap is ready
//
function onDeviceReady() {
// Empty
}
// alert dialog dismissed
function alertDismissed() {
// do something
}
// Show a custom alert
//
function doEmail() {
window.plugins.emailComposer.showEmailComposer("Subject","PlainTextBody", "recipient,recipient", "ccRecipient", "bccRecipient",false);
}
</script>
<link rel="stylesheet" href="style.css" />
然后:
<body onload="onLoad()">
<a href="#" onclick="doEmail(); return false;">Send email</a>
这根本不起作用。
我做了什么:
- 下载了
EmailComposer
插件。
- 将
EmailComposer.js
移至我的应用程式的根目录(Phonegap专案 - > www)。 -
EmailComposer.h
&EmailComposer.m
到我的项目通过在Xcode中右键单击我的www文件夹,然后添加 - >现有文件...(参考类型:复选项到目的地...) - 通过右键单击项目的目标 - >添加
MessageUI.framework
获取信息并将其添加到链接库。
- Downloaded the
EmailComposer
plugin. - Move
EmailComposer.js
to the root of my app (Phonegap project -> www). - Added
EmailComposer.h
&EmailComposer.m
to my project by right-clicking my www folder in Xcode, then "Add" --> "Existing Files..." (REference type: Default, "copy items into destination..." is checked) - Added
MessageUI.framework
to my project by right clicking my project's target -> "Get info" and adding it to linked libraries.
任何帮助都不胜感激。
推荐答案
好吧,我知道这是一个老线程,但它看起来像正确的答案没有发布。对于可能绊倒此问题的未来读者:
Okay, I know this is an old thread but it looks like the correct answer has not been posted. For future readers who may stumble on this:
您必须将EmailComposer插件添加到您的PhoneGap.plist文件中,在插件下添加一行EmailComposer左栏,右键栏中显示EmailComposer。
You have to add the EmailComposer plugin into your PhoneGap.plist file, under plugins add a new row with "EmailComposer" in the left column, and "EmailComposer" in the right column.
这篇关于PhoneGap Email Composer插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!