<?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 Objective-C V2: downloadData and downloadUrl not working in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Objective-C-V2-downloadData-and-downloadUrl-not-working/m-p/243943#M13642</link>
    <description>&lt;P&gt;I've got upload and listFolder working fine but just can't seem to get download to work. &amp;nbsp;If I use downloadData, it succeeds but the fileContents NSData is 'nil'! &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;PRE&gt;    [[[[self client].filesRoutes downloadData:@"/hello.txt"]
      setResponseBlock:^(DBFILESFileMetadata *result, DBFILESDownloadError *routeError, DBRequestError *networkError, NSData *fileContents) {
          if (result) {
              NSLog(@"%@\n", result);
              [[Common sharedInstance].fileMgr removeItemAtPath:localPath error:nil];
              if (!fileContents) {
                  NSLog(@"fileContents == nil!");
              }
              else if ([[Common sharedInstance].fileMgr createFileAtPath:localPath contents:fileContents attributes:nil]) {
                  NSLog(@"%@ created\n", localPath);
              } else {
                  NSLog(@"%@ failed to create\n", localPath);
              }
          } else {
              NSLog(@"DropBoxDataItem -loadFileToPath %@ failed: %@/%@", localPath, routeError, networkError);
          }
      }] setProgressBlock:^(int64_t bytesDownloaded, int64_t totalBytesDownloaded, int64_t totalBytesExpectedToDownload) {
          NSLog(@"totalBytesDownloaded:%lld totalBytesExpectedToDownload:%lld\n", totalBytesDownloaded, totalBytesExpectedToDownload);
      }];&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Test File:&lt;/P&gt;&lt;PRE&gt;1. hello
2. world&lt;/PRE&gt;&lt;P&gt;Console:&lt;/P&gt;&lt;PRE&gt;2017-09-27 18:25:41.468625-0700 neuNotesPlus[2600:1733011] totalBytesDownloaded:17 totalBytesExpectedToDownload:17
2017-09-27 18:25:41.482683-0700 neuNotesPlus[2600:1733011] {
    "client_modified" = "2017-09-28T00:39:54Z";
    "content_hash" = e50df240374d9d527244061aadc6196eef6255feab9b3ebb8e694ed65ee9de1e;
    id = "id:4VBVv54JdnsAAAAAAABN6A";
    name = "hello.txt";
    "path_display" = "/hello.txt";
    "path_lower" = "/hello.txt";
    rev = 927a05d7ff5b;
    "server_modified" = "2017-09-28T00:41:45Z";
    size = 17;
}
2017-09-27 18:25:41.483193-0700 neuNotesPlus[2600:1733011] fileContents == nil!&lt;/PRE&gt;&lt;P&gt;Clearly the file was downloaded per the progress block's NSLog. &amp;nbsp;Yet, the fileContents is nil!?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I try to use downloadUrl, I get the following error:&lt;/P&gt;&lt;PRE&gt;2017-09-27 18:30:11.033183-0700 neuNotesPlus[2604:1734708] local folder exists: /private/var/mobile/Containers/Data/Application/FF881223-E369-4D28-908A-01768DB2D078/tmp
2017-09-27 18:30:11.801532-0700 neuNotesPlus[2604:1734708] totalBytesDownloaded:17 totalBytesExpectedToDownload:17
2017-09-27 18:30:11.826146-0700 neuNotesPlus[2604:1734708] DropBoxDataItem -loadFileToPath /private/var/mobile/Containers/Data/Application/FF881223-E369-4D28-908A-01768DB2D078/tmp/d2.neunote failed: (null)/DropboxClientError[{
    NSError = "Error Domain=NSCocoaErrorDomain Code=4 \"\U201cCFNetworkDownload_qZi9PJ.tmp\U201d couldn\U2019t be moved to \U201ctmp\U201d because either the former doesn\U2019t exist, or the folder containing the latter doesn\U2019t exist.\" UserInfo={NSSourceFilePathErrorKey=/private/var/mobile/Containers/Data/Application/FF881223-E369-4D28-908A-01768DB2D078/Library/Caches/com.apple.nsurlsessiond/Downloads/com.neupen.neuNotesPlus/CFNetworkDownload_qZi9PJ.tmp, NSUserStringVariant=(\n    Move\n), NSDestinationFilePath=/private/var/mobile/Containers/Data/Application/FF881223-E369-4D28-908A-01768DB2D078/tmp/d2.neunote, NSFilePath=/private/var/mobile/Containers/Data/Application/FF881223-E369-4D28-908A-01768DB2D078/Library/Caches/com.apple.nsurlsessiond/Downloads/com.neupen.neuNotesPlus/CFNetworkDownload_qZi9PJ.tmp, NSUnderlyingError=0x1c4440330 {Error Domain=NSPOSIXErrorDomain Code=2 \"No such file or directory\"}}";
}];&lt;/PRE&gt;&lt;P&gt;The output 'tmp' folder exists so the problem must be in the temp file where the SDK initially downloaded the data. &amp;nbsp;Given my experience using downloadData, I'm not surprised there is something wrong with the temp file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What could be causing these issues with just downloading?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thx,&lt;/P&gt;&lt;P&gt;Pete&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 09:19:01 GMT</pubDate>
    <dc:creator>pstoppani</dc:creator>
    <dc:date>2019-05-29T09:19:01Z</dc:date>
    <item>
      <title>Objective-C V2: downloadData and downloadUrl not working</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Objective-C-V2-downloadData-and-downloadUrl-not-working/m-p/243943#M13642</link>
      <description>&lt;P&gt;I've got upload and listFolder working fine but just can't seem to get download to work. &amp;nbsp;If I use downloadData, it succeeds but the fileContents NSData is 'nil'! &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;PRE&gt;    [[[[self client].filesRoutes downloadData:@"/hello.txt"]
      setResponseBlock:^(DBFILESFileMetadata *result, DBFILESDownloadError *routeError, DBRequestError *networkError, NSData *fileContents) {
          if (result) {
              NSLog(@"%@\n", result);
              [[Common sharedInstance].fileMgr removeItemAtPath:localPath error:nil];
              if (!fileContents) {
                  NSLog(@"fileContents == nil!");
              }
              else if ([[Common sharedInstance].fileMgr createFileAtPath:localPath contents:fileContents attributes:nil]) {
                  NSLog(@"%@ created\n", localPath);
              } else {
                  NSLog(@"%@ failed to create\n", localPath);
              }
          } else {
              NSLog(@"DropBoxDataItem -loadFileToPath %@ failed: %@/%@", localPath, routeError, networkError);
          }
      }] setProgressBlock:^(int64_t bytesDownloaded, int64_t totalBytesDownloaded, int64_t totalBytesExpectedToDownload) {
          NSLog(@"totalBytesDownloaded:%lld totalBytesExpectedToDownload:%lld\n", totalBytesDownloaded, totalBytesExpectedToDownload);
      }];&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Test File:&lt;/P&gt;&lt;PRE&gt;1. hello
2. world&lt;/PRE&gt;&lt;P&gt;Console:&lt;/P&gt;&lt;PRE&gt;2017-09-27 18:25:41.468625-0700 neuNotesPlus[2600:1733011] totalBytesDownloaded:17 totalBytesExpectedToDownload:17
2017-09-27 18:25:41.482683-0700 neuNotesPlus[2600:1733011] {
    "client_modified" = "2017-09-28T00:39:54Z";
    "content_hash" = e50df240374d9d527244061aadc6196eef6255feab9b3ebb8e694ed65ee9de1e;
    id = "id:4VBVv54JdnsAAAAAAABN6A";
    name = "hello.txt";
    "path_display" = "/hello.txt";
    "path_lower" = "/hello.txt";
    rev = 927a05d7ff5b;
    "server_modified" = "2017-09-28T00:41:45Z";
    size = 17;
}
2017-09-27 18:25:41.483193-0700 neuNotesPlus[2600:1733011] fileContents == nil!&lt;/PRE&gt;&lt;P&gt;Clearly the file was downloaded per the progress block's NSLog. &amp;nbsp;Yet, the fileContents is nil!?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I try to use downloadUrl, I get the following error:&lt;/P&gt;&lt;PRE&gt;2017-09-27 18:30:11.033183-0700 neuNotesPlus[2604:1734708] local folder exists: /private/var/mobile/Containers/Data/Application/FF881223-E369-4D28-908A-01768DB2D078/tmp
2017-09-27 18:30:11.801532-0700 neuNotesPlus[2604:1734708] totalBytesDownloaded:17 totalBytesExpectedToDownload:17
2017-09-27 18:30:11.826146-0700 neuNotesPlus[2604:1734708] DropBoxDataItem -loadFileToPath /private/var/mobile/Containers/Data/Application/FF881223-E369-4D28-908A-01768DB2D078/tmp/d2.neunote failed: (null)/DropboxClientError[{
    NSError = "Error Domain=NSCocoaErrorDomain Code=4 \"\U201cCFNetworkDownload_qZi9PJ.tmp\U201d couldn\U2019t be moved to \U201ctmp\U201d because either the former doesn\U2019t exist, or the folder containing the latter doesn\U2019t exist.\" UserInfo={NSSourceFilePathErrorKey=/private/var/mobile/Containers/Data/Application/FF881223-E369-4D28-908A-01768DB2D078/Library/Caches/com.apple.nsurlsessiond/Downloads/com.neupen.neuNotesPlus/CFNetworkDownload_qZi9PJ.tmp, NSUserStringVariant=(\n    Move\n), NSDestinationFilePath=/private/var/mobile/Containers/Data/Application/FF881223-E369-4D28-908A-01768DB2D078/tmp/d2.neunote, NSFilePath=/private/var/mobile/Containers/Data/Application/FF881223-E369-4D28-908A-01768DB2D078/Library/Caches/com.apple.nsurlsessiond/Downloads/com.neupen.neuNotesPlus/CFNetworkDownload_qZi9PJ.tmp, NSUnderlyingError=0x1c4440330 {Error Domain=NSPOSIXErrorDomain Code=2 \"No such file or directory\"}}";
}];&lt;/PRE&gt;&lt;P&gt;The output 'tmp' folder exists so the problem must be in the temp file where the SDK initially downloaded the data. &amp;nbsp;Given my experience using downloadData, I'm not surprised there is something wrong with the temp file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What could be causing these issues with just downloading?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thx,&lt;/P&gt;&lt;P&gt;Pete&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:19:01 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Objective-C-V2-downloadData-and-downloadUrl-not-working/m-p/243943#M13642</guid>
      <dc:creator>pstoppani</dc:creator>
      <dc:date>2019-05-29T09:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: Objective-C V2: downloadData and downloadUrl not working</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Objective-C-V2-downloadData-and-downloadUrl-not-working/m-p/243951#M13645</link>
      <description>Hi Pete, I just tried your code (commenting out the 'Common', etc. lines) and it worked correctly for me. I.e., fileContents wasn't nil.&lt;BR /&gt;&lt;BR /&gt;What version of the SDK do you have installed? There was a bug like this in an older version. If you don't have the latest version, currently 3.3.2, please update to that and let me know if you're still seeing this issue. Thanks!</description>
      <pubDate>Thu, 28 Sep 2017 02:04:28 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Objective-C-V2-downloadData-and-downloadUrl-not-working/m-p/243951#M13645</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-09-28T02:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: Objective-C V2: downloadData and downloadUrl not working</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Objective-C-V2-downloadData-and-downloadUrl-not-working/m-p/244034#M13659</link>
      <description>&lt;P&gt;Hmm, 'pod' shows '&lt;SPAN&gt;Using ObjectiveDropboxOfficial (3.0.15)'. &amp;nbsp;Now the question is why pod doesn't update to the latest?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 14:40:06 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Objective-C-V2-downloadData-and-downloadUrl-not-working/m-p/244034#M13659</guid>
      <dc:creator>pstoppani</dc:creator>
      <dc:date>2017-09-28T14:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: Objective-C V2: downloadData and downloadUrl not working</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Objective-C-V2-downloadData-and-downloadUrl-not-working/m-p/244035#M13660</link>
      <description>You'll need to run `pod update` to update your pods. Also make sure your Podfile looks like the example (and isn't locked to a specific version) in order to make sure `pod update` will give you the latest version:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://github.com/dropbox/dropbox-sdk-obj-c#cocoapods" target="_blank"&gt;https://github.com/dropbox/dropbox-sdk-obj-c#cocoapods&lt;/A&gt;</description>
      <pubDate>Thu, 28 Sep 2017 14:41:49 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Objective-C-V2-downloadData-and-downloadUrl-not-working/m-p/244035#M13660</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-09-28T14:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: Objective-C V2: downloadData and downloadUrl not working</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Objective-C-V2-downloadData-and-downloadUrl-not-working/m-p/244047#M13661</link>
      <description>Ah, Podfile specified iOS plath '8.0' instead of '9.0'. That fixed the problem!&lt;BR /&gt;&lt;BR /&gt;Thanks much &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@FBF7D2AB59A0D6E861EBF6A36F93B7E2/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;</description>
      <pubDate>Thu, 28 Sep 2017 15:17:29 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Objective-C-V2-downloadData-and-downloadUrl-not-working/m-p/244047#M13661</guid>
      <dc:creator>pstoppani</dc:creator>
      <dc:date>2017-09-28T15:17:29Z</dc:date>
    </item>
  </channel>
</rss>

