Forum Discussion

H. Reo's avatar
H. Reo
New member | Level 1
11 years ago

SwiftyDropbox API Error

Hello!

I'm trying out SwiftyDropbox

=> https://blogs.dropbox.com/developers/2015/05/try-out-swiftydropbox-the-new-swift-sdk-for-dropbox-api-v2/

 

I can get user's name (with usersGetCurrentAccount() )

 

but I can't get user's filesList(with filesListFolder(path: ""))

error message is 'Bad Input: Error in call to API function "files/list_folder": request body: could not decode input as JSON'

 

 environment

Xcode7

Swift2.0

SwiftyDropbox branch 'swift-2.0'  

 

18 Replies

Replies have been turned off for this discussion
  • Michael K.57's avatar
    Michael K.57
    New member | Level 1
    10 years ago

    1: Wow, that's one of the fastest responses I've ever rec'd... to anything!!

    2: Thank you.

    3: FWIW, all I had to do to fix it and clear the errors was to change line 177 in Client.swift from :

    - let request = client.manager.request(.POST, url, parameters: [:], headers: headers, encoding: ParameterEncoding.Custom {(convertible, _) in

     

    to:  (Note "parameters"...)

     

    - let request = client.manager.request(.POST, url, parameters: [":"], headers: headers, encoding: ParameterEncoding.Custom {(convertible, _) in

     

     After making that tiny little change, all is well!

     

     

       

     

  • Liang M.'s avatar
    Liang M.
    New member | Level 1
    10 years ago

    Thanks Michael K..

    Your tiny little change really works like a charm.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    10 years ago

    For reference, that issue was fixed in release 3.0.0.

  • Liang M.'s avatar
    Liang M.
    New member | Level 1
    10 years ago

    Thanks Gregory.

     

    But I tested the demo app "Photo Watch" a few hours ago, and it does not include the fix using the following Podfile:

     

    platform :ios, '8.0'

    use_frameworks!

    target 'PhotoWatch' do

      pod 'SwiftyDropbox'

    end

     

    I am not familiar with CocoPods, and I presumed that "pod 'SwiftyDropbox'" refers to the master branch. But the pod installed still has the same issue, while the master has it fixed.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    10 years ago

    The PhotoWatch sample app currently only has SwiftyDropbox 2.0.3 installed. You'd need to do a pod update to get the latest release with the fix. 

  • Liang M.'s avatar
    Liang M.
    New member | Level 1
    10 years ago

    Just tested it again.

    pod 'SwiftyDropbox' will install SwiftyDropbox 2.0.3, which has the bug, while pod 'SwiftyDropbox', '~> 3.0.0' will install SwiftyDropbox 3.0.0.

  • Leah C.1's avatar
    Leah C.1
    New member | Level 1
    10 years ago

    Quick update - the PhotoWatch sample app has been updated to SwiftyDropbox 3.0.0 so this issue should be fixed now. Thanks for reporting the issue!

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!