Your workflow is unique 👨‍💻 -  tell us how you use Dropbox here.

Forum Discussion

Bernadetha S.'s avatar
Bernadetha S.
New member | Level 1
9 years ago

SwiftyDropbox not working in iPad device

I'm working on integration SwiftyDropbox with my iOS app, it works fine in simulator get file list, download and upload, unfortunately not in device (an iPad).

After success login, tried to get folder content(client.files.listFolder) the response will takes couple minutes after that I got "Http Error:"

I'm sure it wasn't the internet connection issue. I've tested use different network. it seems I got no response from API. 

I tried the demo, SwiftyTest and got the same result. it works in simulator only. 

did I miss something on setup? 

Any help is appreciated. Thanks

5 Replies

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

    Hi Bernadetha, there shouldn't be anything extra you need to do for this. 

    I can't reproduce this issue though. Can you share the relevant code you're using, and any/all output/errors you're getting? Thanks in advance! 

  • Bernadetha S.'s avatar
    Bernadetha S.
    New member | Level 1
    9 years ago

    Hi Gregory, thanks for the response. 

    I think better to send you my sample project, please give it a try. since the issue happens in real device. https://www.dropbox.com/sh/g8l8h0tl8qoaver/AAB-C8GR34xMsN_ikEsrBcEya?dl=0 

    step to reproduce: 

    1. On welcome screen, click Dropbox button. it displays Dropbox view controller.

    2. do login

    3. if success, it navigates to file screen as follow.

    below pic is the expected result, list of csv files and folder.

    Issue: executing client.files.listFolder takes couple minutes, no files listed and the only error I got is "HTTP Error:" 

    hope you can replicate the issue on device. Thanks in advance.

     

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

    Thanks for the project! Unfortunately, the issue doesn't reproduce for me using this project on a test device. The files and folders do get listed for me.

    Looking at your code though, one thing that might be an issue is how you're using your client object. That is, you're letting client be your authorizedClient, but that might then go out of scope before the response comes in (asynchronously). This could be a timing issue, which might explain why we see it inconsistently.

    Try replacing these lines:

    if let client = Dropbox.authorizedClient {

    with:

    if ((Dropbox.authorizedClient) != nil) {

    And:

    client.files.listFolder(path: dbPath).response { response, error in

    with:

    Dropbox.authorizedClient!.files.listFolder(path: dbPath).response { response, error in

    If that doesn't help, it does sound like a network issue, so I'd recommend checking you can access api.dropboxapi.com on the networks you've tried.

  • Bernadetha S.'s avatar
    Bernadetha S.
    New member | Level 1
    9 years ago

    Many thanks for your assistance. the replacement code doesn't help :( 

    about the network issue (sorry, I'm not expert enough). is there a way to test? if so,  How do you test it? 
    I did from safari on iPad, apr.droboxapi.com navigates to www.dropbox.com. is that the expected resul? I was wonder if I have to use additional tool.

  • Bernadetha S.'s avatar
    Bernadetha S.
    New member | Level 1
    9 years ago

    Hi Gregory, I found the main problem :)

    It wasn't network connection. I used test device that doesn't have signed Apple ID. this morning I used personal device and it's working then compare the environment. I don't know the exact reason, but I think iOS will block any responses from API if no apple ID signed in. 

    anyway, thanks :)

About Dropbox API Support and Feedback

Node avatar for Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.

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!