swift AuthDelegateViewController-1.swift

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了swift AuthDelegateViewController-1.swift相关的知识,希望对你有一定的参考价值。

//  SwiftViewController.swift
//  PrototypeApplication
//
//  Created by Felipe César Silveira de Assis on 12/12/17.
//  Copyright © 2017 CloudRail. All rights reserved.
//

import UIKit
import CloudrailSI

class SwiftViewController: UIViewController, CRAuthenticationDelegate{

  var filesize = 6903974.0;
  
  @IBAction func buttonAction(_ sender: Any) {
    DispatchQueue.global(qos: .background).async {
      print("This will run on the background queue")
      self.basicDropbox()
    }
  }

  fileprivate func basicDropbox() {
    CRCloudRail.setAppKey("[CLOUDRAIL_APP]")
    let dropbox = Dropbox.init(clientId: "[DROPBOX_KEY]", clientSecret: "[DROPBOX_SECRET]")

    dropbox.setDelegate(self)
    dropbox.setTarget(self)

    let imageStreamCustom = InputStream.init(fileAtPath: "/PATH_TO_FILE/IMG_0018.JPG")!
    imageStreamCustom.uploadProgressDelegate = self

    do {
      try print(dropbox.userLogin() ?? "nil value FOUND")
      try dropbox.uploadFileToPath("/justUploaded.jpg", stream: imageStreamCustom, size: 6903974, overwrite: true)
    } catch  {
      print("Exception: \(error)")
    }
  }

  //MARK - AuthenticationDelegate
  func authDidFinish(_ service: [String : String]!) {
      print("Auth did FINISH \(service)")
  }
  func authDidStart(_ service: [String : String]!) {
    print("Auth did START \(service)")
  }
  func authDidCancel(_ service: [String : String]!) {
    print("Auth did CANCEL \(service)")
  }
}

以上是关于swift AuthDelegateViewController-1.swift的主要内容,如果未能解决你的问题,请参考以下文章

Swift入门系列--Swift官方文档(2.2)--中文翻译--About Swift 关于Swift

swift 示例BS swift.swift

swift swift_bug.swift

ios 整理(一)swift和oc的区别

swift swift_extension5.swift

swift swift_optional4.swift