<?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: Dropbox SDK for iOS works on simulator, not on actual device in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-SDK-for-iOS-works-on-simulator-not-on-actual-device/m-p/51322#M1562</link>
    <description>&lt;P&gt;Hi Greg, appreciate the replies. I've been tearing my hair out tonight over the issue, but I'll try to do some logging tomorrow and post the results.&lt;/P&gt;</description>
    <pubDate>Tue, 19 May 2015 06:31:42 GMT</pubDate>
    <dc:creator>Lasse Hammer P.</dc:creator>
    <dc:date>2015-05-19T06:31:42Z</dc:date>
    <item>
      <title>Dropbox SDK for iOS works on simulator, not on actual device</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-SDK-for-iOS-works-on-simulator-not-on-actual-device/m-p/51319#M1559</link>
      <description>&lt;P&gt;I'm making an app which relies on syncing files though Dropbox.&lt;/P&gt;

&lt;P&gt;It works perfectly (syncs, downloads, uploads) when running on the iOS Simulator, but when I run it on my actual device I get the cocoa 516 error (&lt;CODE&gt;NSFileWriteFileExistsError&lt;/CODE&gt;). Even if I clear both device and simulator and reinstalls.&lt;/P&gt;

&lt;P&gt;Any idea on how to solve it?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2015-05-18 23:27:19.385 Home Alone[2218:923269] [ERROR] DBRequest#connectionDidFinishLoading: error moving temp file to desired location: The operation couldn’t be completed. (Cocoa error 516.)

2015-05-18 23:27:19.387 Home Alone[2218:923269] [WARNING] DropboxSDK: error making request to /1/files/dropbox/Projekt 2 (1)/Program/Units.txt - (516) Error Domain=NSCocoaErrorDomain Code=516 "The operation couldn’t be completed. (Cocoa error 516.)" UserInfo=0x174077700 {path=/Projekt 2 (1)/Program/Units.txt, destinationPath=/private/var/mobile/Containers/Bundle/Application/BCF55F91-BAD1-4E01-B8A9-3C925749121B/Home Alone.app/Units.txt}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 May 2019 09:42:44 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-SDK-for-iOS-works-on-simulator-not-on-actual-device/m-p/51319#M1559</guid>
      <dc:creator>Lasse Hammer P.</dc:creator>
      <dc:date>2019-05-29T09:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox SDK for iOS works on simulator, not on actual device</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-SDK-for-iOS-works-on-simulator-not-on-actual-device/m-p/51320#M1560</link>
      <description>&lt;P&gt;[ Cross-linking for reference: &lt;A href="https://stackoverflow.com/questions/30313546/dropbox-sdk-for-ios-works-on-simulator-not-on-actual-device" rel="nofollow noreferrer"&gt;https://stackoverflow.com/questions/30313546/dropbox-sdk-for-ios-works-on-simulator-not-on-actual-device&lt;/A&gt; ]&lt;/P&gt;

&lt;P&gt;I posted an answer on your StackOverflow question a little while ago. Can you check if that was the issue?&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 06:04:38 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-SDK-for-iOS-works-on-simulator-not-on-actual-device/m-p/51320#M1560</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2015-05-19T06:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox SDK for iOS works on simulator, not on actual device</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-SDK-for-iOS-works-on-simulator-not-on-actual-device/m-p/51321#M1561</link>
      <description>&lt;P&gt;Ah, I just noticed you did mention here that you cleared the device in this post. Can you add some logging to check the destination path explicitly and post the output then?&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 06:05:42 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-SDK-for-iOS-works-on-simulator-not-on-actual-device/m-p/51321#M1561</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2015-05-19T06:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox SDK for iOS works on simulator, not on actual device</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-SDK-for-iOS-works-on-simulator-not-on-actual-device/m-p/51322#M1562</link>
      <description>&lt;P&gt;Hi Greg, appreciate the replies. I've been tearing my hair out tonight over the issue, but I'll try to do some logging tomorrow and post the results.&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 06:31:42 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-SDK-for-iOS-works-on-simulator-not-on-actual-device/m-p/51322#M1562</guid>
      <dc:creator>Lasse Hammer P.</dc:creator>
      <dc:date>2015-05-19T06:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox SDK for iOS works on simulator, not on actual device</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-SDK-for-iOS-works-on-simulator-not-on-actual-device/m-p/51323#M1563</link>
      <description>&lt;P&gt;Hi again, I did some testing using NSFileManager. I Added this piece of code before downloading the file into the path:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if fileManager.fileExistsAtPath(localPath) {
    println("File exists")
} else {
    println("File does not exist")
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;On the simulator it prints "file exists", but it downloads the file to the desired location anyways, just overwriting the existing file. On my actual device it prints "file exists", but is unable to overwrite.&lt;/P&gt;

&lt;P&gt;So i tried this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if fileManager.fileExistsAtPath(localPath) {
     println("File exists")
     fileManager.removeItemAtPath(localPath, error: nil)
} else {
     println("File does not exist")
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(This code twice in a row, to check if file was removed successfully)&lt;/P&gt;

&lt;P&gt;On simulator i get: File exists, File does not exist.&lt;BR /&gt;
So again, simulator working as expected.&lt;BR /&gt;
On iPhone i get: File exists, File exists. -&amp;gt; (so still not able to download the item).&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 13:39:44 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-SDK-for-iOS-works-on-simulator-not-on-actual-device/m-p/51323#M1563</guid>
      <dc:creator>Lasse Hammer P.</dc:creator>
      <dc:date>2015-05-19T13:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox SDK for iOS works on simulator, not on actual device</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-SDK-for-iOS-works-on-simulator-not-on-actual-device/m-p/51324#M1564</link>
      <description>&lt;P&gt;The error I get (when I'm not just setting error: nil), is the following on iPhone:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Error Domain=NSCocoaErrorDomain Code=513 "The operation couldn’t be completed. (Cocoa error 513.)" UserInfo=0x17407bf00 {NSFilePath=/private/var/mobile/Containers/Bundle/Application/28F41502-82FC-425D-AF49-31AF48A789E6/Home Alone.app/Units.txt, NSUserStringVariant=(Remove), NSUnderlyingError=0x1740578b0 "The operation couldn’t be completed. Operation not permitted"}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 May 2015 13:55:13 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-SDK-for-iOS-works-on-simulator-not-on-actual-device/m-p/51324#M1564</guid>
      <dc:creator>Lasse Hammer P.</dc:creator>
      <dc:date>2015-05-19T13:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox SDK for iOS works on simulator, not on actual device</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-SDK-for-iOS-works-on-simulator-not-on-actual-device/m-p/51325#M1565</link>
      <description>&lt;P&gt;So it turns out permission issues with my chosen directory was the problem. Simulator just did not care about permissions, or does not use the same set of rules as the actual device as to where the user is allowed to edit the files. I got it working by using the default app documents folder, found by using &lt;CODE&gt;applicationDocumentsDirectory()&lt;/CODE&gt; instead.&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 14:17:13 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-SDK-for-iOS-works-on-simulator-not-on-actual-device/m-p/51325#M1565</guid>
      <dc:creator>Lasse Hammer P.</dc:creator>
      <dc:date>2015-05-19T14:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox SDK for iOS works on simulator, not on actual device</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-SDK-for-iOS-works-on-simulator-not-on-actual-device/m-p/51326#M1566</link>
      <description>&lt;P&gt;Great, I'm glad to hear you were able to sort this out.&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 00:58:32 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-SDK-for-iOS-works-on-simulator-not-on-actual-device/m-p/51326#M1566</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2015-05-20T00:58:32Z</dc:date>
    </item>
  </channel>
</rss>

