当我试图使用2.2SDK在BlackBerry Playbook os2.0中调用FileTransfer方法时,我遇到了一个错误。我使用的是PhoneGap 1.4.0,我的应用程序运行得很好,除了设备上的这一部分。这是我用来测试的一个测试函数。
test(){
var myfile = new FileTransfer();
myfile.download(
'http://www.waterhobo.com/icancolor/html/images/galley2.gif',
"file:///accounts/1000/shared/photos/test.png",
function(result) { console.log("download complete: " +
result.fullPath);},
function(error) {
console.log("download error source " +
error.source);
console.log("download error target " +
error.target);
console.log("upload error code" +
error.code);
}
);
}我得到的错误是:
Error: Status=2 Message=Class FileTransfer cannot be found
book.js:152download error source undefined
book.js:153download error target undefined
book.js:154upload error codeundefined
book.js:514看起来它在phonegap.js文件中找不到该方法,但我已经验证了它在那里。
config.xml如下所示:
<widget xmlns="http://www.w3.org/ns/widgets"
xmlns:rim="http://www.blackberry.com/ns/widgets"
version="1.0.1.0">
<name>iCanColor</name>
<description>
A child Activity
</description>
<license href="http://opensource.org/licenses/alphabetical">
</license>
<!-- PhoneGap API -->
<feature id="blackberry.system" required="true" version="1.0.0.0" />
<feature id="com.phonegap" required="true" version="1.0.0" />
<feature id="blackberry.find" required="true" version="1.0.0.0" />
<feature id="blackberry.identity" required="true" version="1.0.0.0" />
<feature id="blackberry.pim.Address" required="true" version="1.0.0.0" />
<feature id="blackberry.pim.Contact" required="true" version="1.0.0.0" />
<feature id="blackberry.io.file" required="true" version="1.0.0.0" />
<feature id="blackberry.utils" required="true" version="1.0.0.0" />
<feature id="blackberry.io.dir" required="true" version="1.0.0.0" />
<feature id="blackberry.app" required="true" version="1.0.0.0" />
<feature id="blackberry.app.event" required="true" version="1.0.0.0" />
<feature id="blackberry.system.event" required="true" version="1.0.0.0"/>
<feature id="blackberry.widgetcache" required="true" version="1.0.0.0"/>
<feature id="blackberry.media.camera" />
<feature id="blackberry.ui.dialog" />
<!-- PhoneGap API -->
<access subdomains="true" uri="file:///store/home" />
<access subdomains="true" uri="file:///SDCard" />
<access subdomains="true" uri="file:///accounts/1000/shared/photos" />
<!-- Expose access to all URIs, including the file and http protocols -->
<access subdomains="true" uri="*" />
<access subdomains="true" uri="http://www.waterhobo.com" />
<icon rim:hover="false" src="resources/icon.png" />
<icon rim:hover="true" src="resources/icon_hover.png" />
<rim:loadingScreen backgroundColor="#000000"
foregroundImage="resources/loading_foreground.png"
onFirstLaunch="true">
<rim:transitionEffect type="fadeOut" />
</rim:loadingScreen>
<content src="index.html" />
<author href="http://www.msn.com/" rim:copyright="Copyright 1998-2012"></author>
<rim:orientation mode="portrait" />
<rim:permissions>
<rim:permit>use_camera</rim:permit>
<rim:permit>read_device_identifying_information</rim:permit>
<rim:permit>access_shared</rim:permit>
<rim:permit>read_geolocation</rim:permit>
</rim:permissions>
</widget>有谁知道吗?
谢谢
时间
发布于 2012-04-21 02:32:02
它看起来还不受支持。
https://groups.google.com/forum/?fromgroups#!topic/phonegap/XgbWEh3ekUY
我也需要这个,所以我写了这个插件,现在它正在为我工作:
https://github.com/rsweny/ChildBrowser-plugin-for-BlackBerry
您需要的部分是blackberry.polarmobile.childbrowser插件中的.uploadFile。
https://stackoverflow.com/questions/9537283
复制相似问题