2012-09-19 26 views
0

我正在開發一個iPhone應用程序,它將圖像上傳到保管箱。我使用下面的代碼進行圖片上傳。Dropbox圖像上傳結果驗證錯誤

NSData *datobj = UIImagePNGRepresentation(pic.image); 
    NSString *stringConvertion = [[NSString alloc] initWithData:datobj encoding:NSUTF8StringEncoding]; 
    NSString *filename = stringConvertion; 
    NSString *tmpPngFile = [NSTemporaryDirectory() stringByAppendingPathComponent:@"Temp.png"]; 
    [UIImagePNGRepresentation(pic.image) writeToFile:tmpPngFile atomically:NO]; 
    NSString *destDir = @"/"; 
    [[self restClient] uploadFile:filename toPath:destDir 
        withParentRev:nil fromPath:tmpPngFile]; 

但我 錯誤做出要求如下/ 1/files_put/Dropbox的得到一個錯誤 - 身份驗證失敗 我怎樣才能鑑別?

+0

你曾經通過成功的Dropbox下鏈接? – Nikunj

+0

是的......我已成功整合了dropbox-sdk。我在Dropbox中創建了一個應用程序,並獲得了一個關鍵和祕密。我補充說,在AppDelegate中 - DBSession * dbSession = [[DBSession的alloc] initWithAppKey:@ 「mk6v5d6nb4agua6」 appSecret:@ 「k7sb0hengqlog9e」 根:kDBRootDropbox]; [DBSession setSharedSession:dbSession]; –

+0

用於測試,在uploadFile方法中,您可以檢查傳遞臨時文件名,如[[self restClient] uploadFile:@「Temp.png」toPath:destDir withParentRev:nil fromPath:tmpPngFile]; – Nikunj

回答

2

添加以下代碼在info.plist中,第一個標籤

<key>CFBundleURLTypes</key> 
    <array> 
     <dict> 
      <key>CFBundleURLSchemes</key> 
      <array> 
       <string>db-dz0h38qnvcwrzhk</string> 
      </array> 
     </dict> 
    </array>