0
私は、phonegap/cordovaの例を使用して、Windows Phone用のphonegap/cordova 1.6.0のファイルにテキストを書き込むようにしていますAPIは、運がない。Phonegap/Cordova 1.6.0 WP7がwwwフォルダ内のファイルに書き込む
「www」フォルダに手動で作成され、console.logと.onerrorと.onwriteendイベント関数を使用して作成されたファイルです。作者がおそらくこのタスクを完了していることがわかります成功してファイルに書き込むが、ファイルの内容はまったく変わらない。
誰でもこの理由を知っていますか?
ここ(あなたは私が "/app/www/file.txtを" 使用 "のreadme.txt" を参照)APIからの例です:私はWP7約100%わからないんだけど
function onDeviceReady() {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
}
function gotFS(fileSystem) {
fileSystem.root.getFile("readme.txt", {create: true, exclusive: false}, gotFileEntry, fail);
}
function gotFileEntry(fileEntry) {
fileEntry.createWriter(gotFileWriter, fail);
}
function gotFileWriter(writer) {
writer.onwriteend = function(evt) {
console.log("contents of file now 'some sample text'");
writer.truncate(11);
writer.onwriteend = function(evt) {
console.log("contents of file now 'some sample'");
writer.seek(4);
writer.write(" different text");
writer.onwriteend = function(evt){
console.log("contents of file now 'some different text'");
}
};
};
writer.write("some sample text");
}
function fail(error) {
console.log(error.code);
}
あなたは本当に感謝しています。 – lcfb