0

CSV ファイルを作成する小さなアプリを作成しましたが、それをドロップボックス フォルダーにアップロードしたいと考えています。

問題のスキーマ

import SwiftyDropbox

class ViewController: UIViewController {

    func myButtonInControllerPressed() {
        DropboxClientsManager.authorizeFromController(UIApplication.shared,
                                                      controller: self,
                                                      openURL: { (url: URL) -> Void in
                                                        UIApplication.shared.openURL(url)
        })
    }

let client = DropboxClientsManager.authorizedClient
        let fileData = "teste.csv".data(using: String.Encoding.utf8, allowLossyConversion: false)!

        client?.files.upload(path: "/test/path/in/Dropbox/account/HealthkitFromTheGround", input: fileData)
            .response { response, error in
                if let response = response {
                    print(response)
                } else if let error = error {
                    print(error)
                }
            }
            .progress { progressData in
                print(progressData)
        }

let fileName = "teste.csv"
                let tempDir = NSTemporaryDirectory()
                let fileURL = URL(fileURLWithPath: tempDir, isDirectory: true).appendingPathComponent(fileName)

do {
                            try csvString.write(to: fileURL, atomically: true, encoding: .utf8)
                            print("Created file")
                        } catch {
                            print("Failed to create file: \(error)")
                            return
                        }

アプリのドロップボックス フォルダに直接書き込むにはどうすればよいですか?

ありがとう!

4

1 に答える 1