How to get share link with dropbox api in Swift?

十年热恋 提交于 2019-12-10 17:55:18

问题


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?


回答1:


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!)
    }
})


来源:https://stackoverflow.com/questions/34212268/how-to-get-share-link-with-dropbox-api-in-swift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!