Kashif
Kashif

Reputation: 4632

SwiftyDropbox Authorize in Share Extension

I am using the latest v10.0.1 of SwiftyDropbox and trying to authorize the client inside my share extension, so i can upload the shared content to dropbox. I am using the code provided here but the authorizedClient and authorizedBackgroundClient always comes back nil. This authorization works fine in main app. I am just using a random string for session identifier. My code is inside my SLComposeServiceViewController's viewDidLoad:

print(DropboxClientsManager.authorizedBackgroundClient) // nil
if DropboxClientsManager.authorizedBackgroundClient == nil {
    DropboxClientsManager.setupWithAppKey(
        appDropboxKey,
        backgroundSessionIdentifier: "abc-123",
        sharedContainerIdentifier: appUdSharedGroup,
        requestsToReconnect: { requestResults in
            print(requestResults) // nil
        }
    )
    print(DropboxClientsManager.authorizedBackgroundClient) // nil
    guard DropboxClientsManager.authorizedBackgroundClient != nil else {
        return
    }
} else if DropboxClientsManager.authorizedClient == nil {
    DropboxClientsManager.setupWithAppKey(appDropboxKey)
    guard DropboxClientsManager.authorizedClient != nil else {
        return
    }
}

Upvotes: 0

Views: 18

Answers (0)

Related Questions