1

SwiftyDropbox と Swift 3.0 を使用して、UIImageView の画像を Dropbox にアップロードしようとしています。ボタンを押しても、最初の print ステートメントの後に何も起こりません。私は何を間違っていますか。

 import UIKit
 import SwiftyDropbox

 class ViewController: UIViewController {

let client = DropboxClientsManager.authorizedClient

@IBOutlet weak var myPhotoView: UIImageView!


@IBAction func logInAction(_ sender: Any) {
    myButtonPressed()
}

@IBAction func sendPhotoAction(_ sender: Any) {
    print("Button Pressed")

    let fileData = UIImageJPEGRepresentation(myPhotoView.image!, 1.0)
    //let compressedJPGImage = UIImage(data: fileData!)
    let path = "/"
    client?.files.upload(path: path, mode: .overwrite, autorename: true, clientModified: nil, mute: false, input: fileData!).response{ response, error in
        if let _ = response { // to enable use: if let metadata = response {
            print("OK")
        } else {
            print("Error at end")
        }
    }
}

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}


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


}
4

1 に答える 1