<?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: Creating a folder that already exists (iOS) in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167893#M6112</link>
    <description>&lt;P&gt;That would also be a path conflict error. The conflict error itself just means that something is already at the path. You can then check that&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBFILESWriteConflictError.html#/c:objc(cs)DBFILESWriteConflictError(im)isFile" target="_blank" rel="nofollow noreferrer"&gt;DBFILESWriteConflictError&lt;/A&gt;&amp;nbsp;to see if it was a file or folder, e.g. to expand on my last example:&lt;/P&gt;
&lt;PRE&gt; [[client.filesRoutes createFolder:@"/testfolder"] response:^(DBFILESFolderMetadata *result, DBFILESCreateFolderError *cfError, DBError *error) {&lt;BR /&gt;&lt;BR /&gt; if (result) {&lt;BR /&gt; NSLog(@"Create folder succeeded:");&lt;BR /&gt; NSLog(@"%@", result);&lt;BR /&gt; } else {&lt;BR /&gt; NSLog(@"Create folder failed:");&lt;BR /&gt; if (cfError) {&lt;BR /&gt; NSLog(@"The error is a create folder error.");&lt;BR /&gt; if ([cfError isPath]) {&lt;BR /&gt; NSLog(@"The error is a path error.");&lt;BR /&gt; if (cfError.path.isConflict) {&lt;BR /&gt; NSLog(@"Couldn't create folder because there was something in the way.");&lt;BR /&gt; if (cfError.path.conflict.isFolder) {&lt;BR /&gt; NSLog(@"Couldn't create folder because a folder already exists there.");&lt;BR /&gt; } else if (cfError.path.conflict.isFile) {&lt;BR /&gt; NSLog(@"Couldn't create folder because a file already exists there.");&lt;BR /&gt; } else {&lt;BR /&gt; NSLog(@"Other create folder path conflict error:");&lt;BR /&gt; NSLog(@"%@", cfError.path.conflict);&lt;BR /&gt; }&lt;BR /&gt; } else {&lt;BR /&gt; NSLog(@"Other create folder path error:");&lt;BR /&gt; NSLog(@"%@", cfError.path);&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; } else if (error) {&lt;BR /&gt; NSLog(@"The error is a generic error.");&lt;BR /&gt; NSLog(@"%@", error);&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; }];&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Sep 2016 04:19:21 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2016-09-27T04:19:21Z</dc:date>
    <item>
      <title>Creating a folder that already exists (iOS)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167890#M6109</link>
      <description>&lt;P&gt;I went through this already for Android, and I learned that to create a folder that might already exists I only need to check the exception as follows:&lt;/P&gt;
&lt;PRE&gt;catch (CreateFolderErrorException err) {&lt;BR /&gt;if( ! (err.errorValue.isPath() &amp;amp;&amp;amp; err.errorValue.getPathValue().isConflict()) )&lt;BR /&gt;{ /* a real error, to be handled */ }&lt;BR /&gt;else &amp;nbsp;{/*this exception can safely be ignored*/}&lt;/PRE&gt;
&lt;P&gt;Now I need to do the same thing in the Objective-C SDK for iOS. &amp;nbsp;In the completion block for createFolder I get:&lt;/P&gt;
&lt;PRE&gt;^(DBFILESFolderMetadata *result, DBFILESCreateFolderError *cfError, DBError *error)&lt;/PRE&gt;
&lt;P&gt;What is the equivalent check using "result", "cfError", and "error"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:29:49 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167890#M6109</guid>
      <dc:creator>Robert S.138</dc:creator>
      <dc:date>2019-05-29T09:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a folder that already exists (iOS)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167891#M6110</link>
      <description>&lt;P&gt;In this case, you'd get a&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBFILESCreateFolderError.html#/c:objc(cs)DBFILESCreateFolderError(py)path" target="_blank" rel="nofollow noreferrer"&gt;DBFILESCreateFolderError&lt;/A&gt; in your cfError variable, containing a "conflict"&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBFILESWriteError.html" target="_blank" rel="nofollow noreferrer"&gt;DBFILESWriteError&lt;/A&gt;&amp;nbsp;in the path field.&lt;/P&gt;
&lt;P&gt;Here's an example of how you'd detect the different error cases, picking out the conflict error:&lt;/P&gt;
&lt;PRE&gt; [[client.filesRoutes createFolder:@"/testfolder"] response:^(DBFILESFolderMetadata *result, DBFILESCreateFolderError *cfError, DBError *error) {&lt;BR /&gt;&lt;BR /&gt; if (result) {&lt;BR /&gt; NSLog(@"Create folder succeeded:");&lt;BR /&gt; NSLog(@"%@", result);&lt;BR /&gt; } else {&lt;BR /&gt; NSLog(@"Create folder failed:");&lt;BR /&gt; if (cfError) {&lt;BR /&gt; NSLog(@"The error is a create folder error.");&lt;BR /&gt; if ([cfError isPath]) {&lt;BR /&gt; NSLog(@"The error is a path error.");&lt;BR /&gt; if (cfError.path.isConflict) {&lt;BR /&gt; NSLog(@"Couldn't create folder because there was something in the way.");&lt;BR /&gt; } else {&lt;BR /&gt; NSLog(@"Other create folder path error:");&lt;BR /&gt; NSLog(@"%@", cfError.path);&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; } else if (error) {&lt;BR /&gt; NSLog(@"The error is a generic error.");&lt;BR /&gt; NSLog(@"%@", error);&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; }];&lt;/PRE&gt;
&lt;P&gt;(Apologies for the poor formatting.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2016 03:30:10 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167891#M6110</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-09-27T03:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a folder that already exists (iOS)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167892#M6111</link>
      <description>&lt;P&gt;Thanks Gregory. &amp;nbsp;I had just figured out something like that from the comments in the Dropbox header files (more useful in this case than the HTML docs) and was just about to post something like that:&lt;/P&gt;
&lt;PRE&gt;if(cfError) {&lt;BR /&gt;  if((cfError.isPath) {&lt;BR /&gt;    DBFILESWriteError *werr = cfError.path;&lt;BR /&gt;    if(werr.isConflict) {&lt;BR /&gt;      NSLog(@"--This error can be safely ignored--");&lt;BR /&gt;    }&lt;BR /&gt;  }&lt;BR /&gt;}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I wonder what would happen if there is a "conflict", not because the folder already exists in Dropbox, but because a FILE by that name already exists in Dropbox. &amp;nbsp;Obviously such an error should not be ignored. &amp;nbsp;But will such an error distinguish itself from the folder already existing condition?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2016 03:56:09 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167892#M6111</guid>
      <dc:creator>Robert S.138</dc:creator>
      <dc:date>2016-09-27T03:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a folder that already exists (iOS)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167893#M6112</link>
      <description>&lt;P&gt;That would also be a path conflict error. The conflict error itself just means that something is already at the path. You can then check that&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBFILESWriteConflictError.html#/c:objc(cs)DBFILESWriteConflictError(im)isFile" target="_blank" rel="nofollow noreferrer"&gt;DBFILESWriteConflictError&lt;/A&gt;&amp;nbsp;to see if it was a file or folder, e.g. to expand on my last example:&lt;/P&gt;
&lt;PRE&gt; [[client.filesRoutes createFolder:@"/testfolder"] response:^(DBFILESFolderMetadata *result, DBFILESCreateFolderError *cfError, DBError *error) {&lt;BR /&gt;&lt;BR /&gt; if (result) {&lt;BR /&gt; NSLog(@"Create folder succeeded:");&lt;BR /&gt; NSLog(@"%@", result);&lt;BR /&gt; } else {&lt;BR /&gt; NSLog(@"Create folder failed:");&lt;BR /&gt; if (cfError) {&lt;BR /&gt; NSLog(@"The error is a create folder error.");&lt;BR /&gt; if ([cfError isPath]) {&lt;BR /&gt; NSLog(@"The error is a path error.");&lt;BR /&gt; if (cfError.path.isConflict) {&lt;BR /&gt; NSLog(@"Couldn't create folder because there was something in the way.");&lt;BR /&gt; if (cfError.path.conflict.isFolder) {&lt;BR /&gt; NSLog(@"Couldn't create folder because a folder already exists there.");&lt;BR /&gt; } else if (cfError.path.conflict.isFile) {&lt;BR /&gt; NSLog(@"Couldn't create folder because a file already exists there.");&lt;BR /&gt; } else {&lt;BR /&gt; NSLog(@"Other create folder path conflict error:");&lt;BR /&gt; NSLog(@"%@", cfError.path.conflict);&lt;BR /&gt; }&lt;BR /&gt; } else {&lt;BR /&gt; NSLog(@"Other create folder path error:");&lt;BR /&gt; NSLog(@"%@", cfError.path);&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; } else if (error) {&lt;BR /&gt; NSLog(@"The error is a generic error.");&lt;BR /&gt; NSLog(@"%@", error);&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; }];&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2016 04:19:21 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167893#M6112</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-09-27T04:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a folder that already exists (iOS)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167894#M6113</link>
      <description>&lt;P&gt;At first I got an error with&amp;nbsp;(cfError.path.conflict.isFolder), but then I realized that I just needed to include:&lt;/P&gt;
&lt;P&gt;#import &amp;lt;DBFILESWriteConflictError.h&amp;gt;&lt;/P&gt;
&lt;P&gt;and now it compiles without errors. &amp;nbsp;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2016 08:19:41 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167894#M6113</guid>
      <dc:creator>Robert S.138</dc:creator>
      <dc:date>2016-09-27T08:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a folder that already exists (iOS)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167895#M6114</link>
      <description>&lt;P&gt;Glad to hear that's working now. That import shouldn't really be necessary though. What version of the SDK do you have installed? What other imports do you have?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2016 11:06:18 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167895#M6114</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-09-27T11:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a folder that already exists (iOS)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167896#M6115</link>
      <description>&lt;P&gt;Here are my Dropbox imports:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;#include &amp;lt;DBAUTHAuthError.h&amp;gt;&lt;/P&gt;
&lt;P&gt;#include &amp;lt;DBFILESWriteConflictError.h&amp;gt;&lt;/P&gt;
&lt;P&gt;#include &amp;lt;DBErrors.h&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I comment out the middle one, I get the error on 'isFolder".&lt;/P&gt;
&lt;P&gt;I suggest that you put the required import files into the documentation, like Microsoft does with all their Win32 API functions.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2016 19:47:18 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167896#M6115</guid>
      <dc:creator>Robert S.138</dc:creator>
      <dc:date>2016-09-27T19:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a folder that already exists (iOS)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167897#M6116</link>
      <description>&lt;P&gt;I see, thanks for clarifying. We do have a general import you can use as shown in the &lt;A href="https://github.com/dropbox/dropbox-sdk-obj-c#try-some-api-requests" target="_blank" rel="nofollow noreferrer"&gt;readme&lt;/A&gt;:&lt;/P&gt;
&lt;PRE&gt;#import &amp;lt;ObjectiveDropboxOfficial/ObjectiveDropboxOfficial.h&amp;gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Sep 2016 00:31:13 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167897#M6116</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-09-28T00:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a folder that already exists (iOS)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167898#M6117</link>
      <description>&lt;P&gt;When I try to add that import to my source file, I get a file not found error. &amp;nbsp;I installed Dropbox with Cocoapods. &amp;nbsp;Is there some different path I should use with that? &amp;nbsp;Or is there some build setting I am lacking? &amp;nbsp;I poked around with a Finder window and did not find any such header file, although I did locate all the other Dropbox header files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 02:59:15 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167898#M6117</guid>
      <dc:creator>Robert S.138</dc:creator>
      <dc:date>2016-09-28T02:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a folder that already exists (iOS)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167899#M6118</link>
      <description>&lt;P&gt;This did change a bit over the versions. &amp;nbsp;Are you using the latest version of the SDK? If not, please pod update and try again.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 03:01:06 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167899#M6118</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-09-28T03:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a folder that already exists (iOS)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167900#M6119</link>
      <description>&lt;P&gt;That fixed it. &amp;nbsp;Now just one import replaces all the other Dropbox imports I was using.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 04:05:39 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-that-already-exists-iOS/m-p/167900#M6119</guid>
      <dc:creator>Robert S.138</dc:creator>
      <dc:date>2016-09-28T04:05:39Z</dc:date>
    </item>
  </channel>
</rss>

