2012-03-26 31 views
1

我使用DropBox SDK for IOS上傳文件時遇到問題。當我嘗試從我的應用程序的文檔文件夾上傳文件時。DropboxSDK:無法上傳IOS SDK的文件夾()

我按照這個教程:tutorial

獲取誤差

[WARNING] DropboxSDK: Unable to upload folders (/Users/*******/Library/Application Support/iPhone Simulator/5.0/Applications/DAE13E8C-9833-463C-A073-D114FB0FFD1A/Documents/contact)

我的代碼段如下所示。

[[self restClient] uploadFile:filename toPath:destDir withParentRev:nil fromPath:localPath];

+0

我發現這個問題,並固定它。我們需要整個文件的本地路徑。我只給了該文件夾。文件名不包括在內。 – 2012-03-27 04:19:51

回答

4

你唯一的問題是,「fromPath」期望不只是路徑,但與附加到它的文件名的路徑:

NSString *sourcePath = [localPath stringByAppendingPathComponent: sourceFile]; 
    if ([app.globalObject fileExists: sourcePath]) { 
     NSString *destDir = @"/"; 
     [[self restClient] uploadFile: sourceFile 
           toPath: destDir 
         withParentRev: nil 
          fromPath: sourcePath]; 
    }