Hi -- my macOS app was working fine when I was downloading from Dropbox in the main app, but once I added download calls from my FileProvider helper app, I started getting a string of errors.
First, in order to let both components talk to each other, I had to create my own transport client with the shared container identifier, otherwise keeping the default values:
let transportClient = DropboxTransportClient(accessToken: "", baseHosts: nil, userAgent: nil, selectUser: nil,
sessionDelegate: nil, backgroundSessionDelegate: nil,
longpollSessionDelegate: nil, serverTrustPolicyManager: nil,
sharedContainerIdentifier: GROUP_CONTAINER_NAME, pathRoot: nil)
DropboxClientsManager.setupWithAppKeyDesktop("oc..........sn", transportClient: transportClient)
(Note that inside the setupWithAppKeyDesktop calls, the OAuth class puts its own accessTokenProvider into the DropboxTransportClient, overwriting the dummy access token generated by the above call. This works -- I successfully connect to Dropbox and all my foreground Dropbox calls work; it's only file downloads which produce the background session errors.)
After this change, I started seeing errors in both my main program and my extension.
022-01-14 22:32:26.846998+1100 EMPSecure[3620:78577] BackgroundSession <E635FAD8-8431-4A6B-81AC-4C5C7163B8F6> an error occurred on the xpc connection to setup the background session: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service on pid 0 named com.apple.nsurlsessiond" UserInfo={NSDebugDescription=connection to service on pid 0 named com.apple.nsurlsessiond}
2022-01-14 22:32:26.847475+1100 EMPSecure[3620:79841] BackgroundSession <E635FAD8-8431-4A6B-81AC-4C5C7163B8F6> connection to background transfer daemon interrupted
2022-01-14 22:32:26.847552+1100 EMPSecure[3620:79858] BackgroundSession <E635FAD8-8431-4A6B-81AC-4C5C7163B8F6> connection to background transfer daemon invalidated
These errors occur repeatedly -- the last two more often than the first one -- from both the main process and the FileProvider app extension. If it were just a matter of the app-ex not being able to cope with an API restriction, I'd expect that to fail while the main process succeeded; it looks like it's a problem on both sides.
Any ideas what I'm doing wrong? Do I need to define my own session delegates, change my entitlements, or something else?
(BTW, I can't check the appropriate classes in the SwiftyDropbox documentation; since the 8.2.1 release the left-hand column of https://dropbox.github.io/SwiftyDropbox/api-docs/latest/ , with the class definitions, is not working.)