<?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: NSURLErrorDomainCode=-1005 with authorizedClient in iOS-App in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/NSURLErrorDomainCode-1005-with-authorizedClient-in-iOS-App/m-p/647523#M29690</link>
    <description>&lt;P&gt;Dear GregDB,&lt;/P&gt;&lt;P&gt;thanks for the quick reply. As you assumed, it may be linked to the connection issues.&lt;/P&gt;&lt;P&gt;To handle these errors properly, is there a list/description of the different error codes available?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards gcarl&lt;/P&gt;</description>
    <pubDate>Sun, 01 Jan 2023 11:39:24 GMT</pubDate>
    <dc:creator>gcarl</dc:creator>
    <dc:date>2023-01-01T11:39:24Z</dc:date>
    <item>
      <title>NSURLErrorDomainCode=-1005 with authorizedClient in iOS-App</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/NSURLErrorDomainCode-1005-with-authorizedClient-in-iOS-App/m-p/646904#M29677</link>
      <description>&lt;P&gt;Dear community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I developed a cookbook-app for iOS to manage recipes. The app saves the recipe data in a json-file on a Dropbox folder, which can be defined by the user. If photos are linked to a recipe, these are saved separately in jpg-files on the Dropbox too. The recipe data are loaded when the app is started or when recipes are edited. The photos are loaded when the recipe, to which the photos are linked, is selected to be displayed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As described in SwiftyDropbox manual, I do the authorization with the following workflow&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;func connectDropbox(withRequest request: Dropboxrequest) {
        dropboxrequest = request
        let scopeRequest = ScopeRequest(scopeType: .user, scopes: ["files.content.write", "files.content.read", "account_info.read"], includeGrantedScopes: true)
            DropboxClientsManager.authorizeFromControllerV2(
                UIApplication.shared,
                controller: self,
                loadingStatusDelegate: nil,
                openURL: { (url: URL) -&amp;gt; Void in UIApplication.shared.open(url, options: [:], completionHandler: nil) },
                scopeRequest: scopeRequest
            )
    }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and handle the redirect as described. All works fine so far.&amp;nbsp;Unfortunately, the connection to the dropbox seems to be not stable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Before reading or writing data, I check, if an authorized client exists as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;if let client = DropboxClientsManager.authorizedClient /*getClient()*/ {
    dropboxrequest = .checkFile
    client.files.download(path: aktuellesKochbuch.credentials.urlFile)
        .response { response, error in
            if let response = response {
                let _ = response.0
                let fileContents = response.1
                self.finishInit(withData: fileContents, withError: false)
            } else if let error = error {
                switch error as CallError {
                case .routeError:
                    self.finishInit(withData: Data(), withError: true)
                default:
                    showAlert(withTitle: String(format: NSLocalString("E036 Dropbox access error: \n%@", comment: "E036 Fehler Dropboxzugriff"),error.description), withMessage: "Please check Dropbox status")
                    return
                }
            }
        }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;especially, if the app is in use for a longer time, it leads to the following Callerror:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;E036 Fehler Dropboxzugriff: sessionTaskFailed (error: Error
Domain=NSURLErrorDomain
Code=-1005 "Die
Netzwerkverbindung wurde
unterbrochen."
Userinfo=&amp;lt;_kCFStreamErrorCodeKey=-4,
NSUnderlyingError=0x282391cb0 {Error
Domain=kCFErrorDomainCFNetwork Code=-1005 " (null)" UserInfo=&amp;lt;NSErrorPeerAddressKev=&amp;lt;CFData0x280ed5040[Ox212cdc580]&amp;gt;{length = 16,capacity = 16, bytes =
0x100201bba27d420e0000000000000000}, 
_kCFStreamErrorCodeKey=-4
_kCFStreamErrorDomainKey=4}},
NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask
...&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One user, who is reporting many of these errors, has stored the data on a shared folder with another user in Dropbox.&lt;/P&gt;
&lt;P&gt;Does anyone have an idea, what the reason for this instability could be?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your support.&lt;/P&gt;
&lt;P&gt;gcarl&lt;/P&gt;</description>
      <pubDate>Thu, 29 Dec 2022 10:18:38 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/NSURLErrorDomainCode-1005-with-authorizedClient-in-iOS-App/m-p/646904#M29677</guid>
      <dc:creator>gcarl</dc:creator>
      <dc:date>2022-12-29T10:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: NSURLErrorDomainCode=-1005 with authorizedClient in iOS-App</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/NSURLErrorDomainCode-1005-with-authorizedClient-in-iOS-App/m-p/646939#M29678</link>
      <description>&lt;P&gt;That error is being reported by the iOS network client and &lt;A href="https://developer.apple.com/documentation/foundation/nsurlerrornetworkconnectionlost" target="_blank"&gt;that "-1005" error code in particular&lt;/A&gt; indicates that the network connection was lost.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does this happen for all users all the time, or only some users/some of the time?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it only happens sometimes, it may indicate that the network connection was lost for some reason; some of the following may be possible causes:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;if the network connection is lost, such as due to losing WiFi or cellular reception&lt;/LI&gt;
&lt;LI&gt;if the network connection switches between different interfaces, such as WiFi versus cellular&lt;/LI&gt;
&lt;LI&gt;if the app is quit during the connection&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Those aren't conditions you can control of course, so you may want to add some automatic retrying to handle those.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this isn't reproducible for all users/devices, it may be specific to the particular network connections of the affected users/devices. In that case, is there anything that may be interfering with HTTPS connections to api-content.dropbox.com on those network connections? For example, firewalls, proxies, VPNs, etc. may be interfering.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2022 17:43:43 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/NSURLErrorDomainCode-1005-with-authorizedClient-in-iOS-App/m-p/646939#M29678</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-12-28T17:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: NSURLErrorDomainCode=-1005 with authorizedClient in iOS-App</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/NSURLErrorDomainCode-1005-with-authorizedClient-in-iOS-App/m-p/647523#M29690</link>
      <description>&lt;P&gt;Dear GregDB,&lt;/P&gt;&lt;P&gt;thanks for the quick reply. As you assumed, it may be linked to the connection issues.&lt;/P&gt;&lt;P&gt;To handle these errors properly, is there a list/description of the different error codes available?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards gcarl&lt;/P&gt;</description>
      <pubDate>Sun, 01 Jan 2023 11:39:24 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/NSURLErrorDomainCode-1005-with-authorizedClient-in-iOS-App/m-p/647523#M29690</guid>
      <dc:creator>gcarl</dc:creator>
      <dc:date>2023-01-01T11:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: NSURLErrorDomainCode=-1005 with authorizedClient in iOS-App</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/NSURLErrorDomainCode-1005-with-authorizedClient-in-iOS-App/m-p/647702#M29694</link>
      <description>&lt;P&gt;It looks like Apple has a list of such errors documented here: &lt;A href="https://developer.apple.com/documentation/cfnetwork/cfnetworkerrors" target="_blank"&gt;https://developer.apple.com/documentation/cfnetwork/cfnetworkerrors&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jan 2023 15:19:42 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/NSURLErrorDomainCode-1005-with-authorizedClient-in-iOS-App/m-p/647702#M29694</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2023-01-02T15:19:42Z</dc:date>
    </item>
  </channel>
</rss>

