2013-04-04 110 views
1

我遇到了一個問題,我找不到任何解決方案。 我正在使用Xcode版本4.5.1(4G1004),Cordova-2.5.0,iPhone4S(版本5.0(9A334))Phonegap,可可錯誤257 - 操作無法完成。不允許操作

我想要做的是從本地文件系統發送文件(/ var /mobile/Library/Notes/notes.sqlite)使用遠程服務器

var ft = new FileTransfer(); 
ft.upload("/var/mobile/Library/Notes/notes.sqlite", encodeURI("http://myserver.com/fileUpload.php"), win, fail, null); 

function win(r) { 
      console.log("Code = " + r.responseCode); 
      console.log("Response = " + r.response); 
      console.log("Sent = " + r.bytesSent); 
     } 

     function fail(error) { 
      alert("An error has occurred: Code = " + error.code); 
      console.log("upload error source " + error.source); 
      console.log("upload error target " + error.target); 
     } 

但它失敗,錯誤:

Error opening file /var/mobile/Library/Notes/notes.sqlite: Error Domain=NSCocoaErrorDomain Code=257 "The operation couldn’t be completed. (Cocoa error 257.)" UserInfo=0x164070 {NSFilePath=/var/mobile/Library/Notes/notes.sqlite, NSUnderlyingError=0x148670 "The operation couldn’t be completed. Operation not permitted"} 
FileTransferError { 
    code = 1; 
    source = "/var/mobile/Library/Notes/notes.sqlite"; 
    target = "xxxxxxxxxxxxxxxxxxx/fileUpload.php"; 
} 

如果我對接觸圖像做同樣的事情,一切正常。

ft.upload("/var/mobile/Applications/367E3D28-2912-4E2B-B798-B49D71F9CAE6/tmp/photo_HHcOG", encodeURI("xxxxxxxxxxx/fileUpload.php"), win, fail, null); 

我已經看過檔案和提交,但沒有發現不同之處在於它是某種權限問題的,這是我從(可可錯誤257)錯誤理解的任何解決方案。 是否有一種方法來分配文件notes.sqlite的權限(我檢查了notes.sqlite的權限(使用文件管理器),並且與photo_HHcOG相同)。我想也許這不是文件權限,而是文件夾或用戶權限,因爲我試圖將notes.sqlite的權限更改爲每個人都寫,但結果相同。

有人知道可能是什麼問題,這是否已被修復,並指出我正確的方向?

謝謝。

回答

0

來自蘋果

不,你不能。 沙箱是有原因的。

這意味着你只能讀取/創建你的應用程序文件夾中的文件。

兩個應用程序可以使用comunicate UIDocumentInteractionController

但現在不是股票筆記應用程序。

相關問題