1

I'm new to the coding!!!

Here is my code! I tried to let the user recording then uploading the audio file to the dropbox. I have already applied for the Dropbox API and got the App Key!!

My version is Xcode 14.3

The question 1 is "should I add "db-"in front of my app key?" The question 2 is I have no idea that is the .plist setting is correct?

I always got the reply: Dropbox is not authorized or logged in

enter image description here

import UIKit
import SwiftyDropbox


class AppDelegate: UIResponder, UIApplicationDelegate {
 
    var window: UIWindow?
 
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
 
        DropboxClientsManager.setupWithAppKey("**db-app key???**")
 
        return true
    }
    
    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
        DropboxClientsManager.handleRedirectURL(url) { authResult in
            switch authResult {
            case .success:
                print("Dropbox authorization success")
            case .cancel:
                print("Dropbox authorization canceled")
            case .error(_, let description):
                print("Dropbox authorization error: \(description)")
            @unknown default:
                print("Unknown Dropbox authorization result")
            }
        }
        return false
    }
}

I would like to know the setting of the .plist is correct or not? Xcode 14.3 seem like do not have the "LSApplicationQueriesSchemes" or "CFBundleURLTypes"

I cannot authorized in to the dropbox!!!

Vivi
  • 11
  • 2

1 Answers1

0

Per the SwiftyDropbox "Application .plist file" documentation, the value in CFBundleURLSchemes should have the "db-" prefix, so you should add a "db-" prefix to your app key there. The samples and screenshot there show what the result should look like.

Per the SwiftyDropbox "Initialize a DropboxClient instance" documentation, the value passed to DropboxClientsManager.setupWithAppKey should be your app key. You should not add a "db-" prefix.

To connect to an account follow the instructions under the SwiftyDropbox "Begin the authorization flow" documentation.

Greg
  • 16,359
  • 2
  • 34
  • 44