<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Download files from Dropbox (swift &amp; SDK 1.3.13) in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-from-Dropbox-swift-SDK-1-3-13/m-p/84314#M2559</link>
    <description>&lt;P&gt;Just put your code to read the file in your implementation of &lt;CODE&gt;loadedFile&lt;/CODE&gt;.&lt;/P&gt;</description>
    <pubDate>Tue, 26 May 2015 04:20:38 GMT</pubDate>
    <dc:creator>Steve M.</dc:creator>
    <dc:date>2015-05-26T04:20:38Z</dc:date>
    <item>
      <title>Download files from Dropbox (swift &amp; SDK 1.3.13)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-from-Dropbox-swift-SDK-1-3-13/m-p/84313#M2558</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I noticed that DBRestClient is asynchronous, it means that When I download file from Dropbox, I cannot read it immediately.&lt;BR /&gt;
I put in place a While (to wait upload completed) but I have not success, could you please help?&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Sébastien&lt;/P&gt;

&lt;P&gt;My VIEW code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;class ViewController: UIViewController, DBRestClientDelegate {
    private var FileLoaded = false

    ...

    @IBAction func btDownload(sender: AnyObject) {
        txtFileReader.text=""
        txtLogs.insertText("Start DL file \n")
        let tmpDirectory = NSTemporaryDirectory()
        let myFilename = tmpDirectory.stringByAppendingPathComponent("Test.txt")
        FileLoaded=false
        dbRestClient?.loadFile("/MyFolder/Test.txt", intoPath: myFilename)
        while FileLoaded {
            txtFileReader.text = String(contentsOfFile: myFilename, encoding: NSUTF8StringEncoding, error: nil)
        }
        txtLogs.insertText(" \(myFilename) \n")
        txtLogs.insertText("End DL file \n")
    }

    func restClient(client: DBRestClient!, loadedFile localPath: String, contentType contentType: String, metadata metadata: DBMetadata!){
        println("File loaded into path: \(localPath)")
        FileLoaded=true
    }
    func restClient(client: DBRestClient!, loadFileFailedWithError error: NSError!){
        println("LoadFile failed with error: \(error)")
    }
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 May 2019 09:42:32 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-from-Dropbox-swift-SDK-1-3-13/m-p/84313#M2558</guid>
      <dc:creator>Ricky B.5</dc:creator>
      <dc:date>2019-05-29T09:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: Download files from Dropbox (swift &amp; SDK 1.3.13)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-from-Dropbox-swift-SDK-1-3-13/m-p/84314#M2559</link>
      <description>&lt;P&gt;Just put your code to read the file in your implementation of &lt;CODE&gt;loadedFile&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2015 04:20:38 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-from-Dropbox-swift-SDK-1-3-13/m-p/84314#M2559</guid>
      <dc:creator>Steve M.</dc:creator>
      <dc:date>2015-05-26T04:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: Download files from Dropbox (swift &amp; SDK 1.3.13)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-from-Dropbox-swift-SDK-1-3-13/m-p/84315#M2560</link>
      <description>&lt;P&gt;Hello Steve,&lt;BR /&gt;
Thanks for your reply, it exactly what I did and it works properly.&lt;BR /&gt;
Just for my information, there is no better way to catch the result ? like I wanted to do before ?&lt;/P&gt;

&lt;P&gt;Thanks again,&lt;BR /&gt;
Sébastien&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2015 20:41:31 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-from-Dropbox-swift-SDK-1-3-13/m-p/84315#M2560</guid>
      <dc:creator>Ricky B.5</dc:creator>
      <dc:date>2015-05-27T20:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Download files from Dropbox (swift &amp; SDK 1.3.13)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-from-Dropbox-swift-SDK-1-3-13/m-p/84316#M2561</link>
      <description>&lt;P&gt;This SDK uses delegates, so the expected way to write code is to call &lt;CODE&gt;loadFile&lt;/CODE&gt; and then continue with the next step in &lt;CODE&gt;loadedFile&lt;/CODE&gt;. If you take a look at our &lt;A href="https://blogs.dropbox.com/developers/2015/05/try-out-swiftydropbox-the-new-swift-sdk-for-dropbox-api-v2/" rel="nofollow noreferrer"&gt;v2 Swift SDK preview&lt;/A&gt;, you'll see that we're moving towards using blocks in the future instead of delegates, which I hope you'll find more intuitive.&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2015 00:08:50 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-from-Dropbox-swift-SDK-1-3-13/m-p/84316#M2561</guid>
      <dc:creator>Steve M.</dc:creator>
      <dc:date>2015-05-28T00:08:50Z</dc:date>
    </item>
  </channel>
</rss>

