如何在Swift中使用Dropbox API获取共享链接? [英] How to get share link with dropbox api in Swift?

查看:55
本文介绍了如何在Swift中使用Dropbox API获取共享链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个应用程序,允许用户将文件上传到保管箱,然后获得共享该文件的选项。如何获得文件的保管箱链接?好像我可以使用
client.sharing.createSharedLink(path: / myfile)
一样,但是我如何以字符串形式访问该数据呢?

I want to make an app that lets a user upload a file to dropbox and then get options to share that file. How can I get a dropbox link for a file? It seems like I could use client.sharing.createSharedLink(path:"/myfile") but how would I access that data as a String?

推荐答案

以下是您如何在SwiftyDropbox中使用 createSharedLink 获取文件的共享链接的示例,在此示例中为路径/test.txt。

Here's a sample of how you could use createSharedLink in SwiftyDropbox to get a shared link to a file, in this example at the path /test.txt.

Dropbox.authorizedClient!.sharing.createSharedLink(path: "/test.txt").response({ response, error in
    if let link = response {
        print(link.url)
    } else {
        print(error!)
    }
})

这篇关于如何在Swift中使用Dropbox API获取共享链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆