ios - Dropbox Chooser 无法快速处理链接 ios

标签 ios swift dropbox-api

我试图在我的 ios/swift 项目中实现 Dropbox Chooser 框架。一切看起来都很好。但是从 Dropbox 选择文件时我无法收到链接。只有我在 Dropbox 应用程序中看到带有文本“正在生成链接”的对话框一秒钟。我的问题在哪里?抱歉我的英语不好。

这是我的 UIViewController 中的按钮:

func dropboxBtn(sender: AnyObject) {
   // println("dropboxBtn")
    let dbChooser = DBChooser(appKey: "drop-in-app-key")
    dbChooser.openChooserForLinkType(DBChooserLinkTypePreview, fromViewController: self, completion: { (results: [AnyObject]!) -> Void in
        println(results.description)
    })

}

这是我在 AppDelegate.swift 中的应用程序函数

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {

    println("openURL")
    let dbChooser = DBChooser(appKey: "drop-in-app-key")
    if (dbChooser.handleOpenURL(url)) {
        return true
    }

    return false

}

我在控制台中没有收到任何信息...

最佳答案

我发现了我的问题! 我忘记了这个配置 -> 在 URL 方案中输入 db-APP_KEY(将 APP_KEY 替换为您创建应用程序时生成的 key )。 现在我的方法改变了。 在我的 UIViewController 中:

func dropboxBtn(sender: AnyObject) {

    DBChooser.defaultChooser().openChooserForLinkType(DBChooserLinkTypePreview, fromViewController: self, completion: { (results: [AnyObject]!) -> Void in
        println(results.description)
    })
}

在我的 AppDelegate.swift 中:

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {

    if (DBChooser.defaultChooser().handleOpenURL(url)) {
        return true
    }
    return false
}

关于ios - Dropbox Chooser 无法快速处理链接 ios,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27946870/

相关文章:

ios - 在 Swift 中将对象数组排序为每个可能的序列

ios - iOS 上 Dropbox sync api 的文件同步问题

ios - Bitbucket 无法识别我的 Swift 项目

iphone - XCode:当用户点击 UITextbox 时显示 UIDatePicker

iphone - 如何相对于屏幕 iPhone 的一侧锚定 View

swift - 2 十进制定时器在 swift

swift - 如何使用自定义类型存储和检索变量

ios - spritekit 中的多个 NSTimer 未按预期工作

ios - 如何在 iOS 上取消链接或注销 Dropbox 帐户

file-upload - Dropbox API : Upload a File to Root directory for app with Full Dropbox