ios - 如何检查是否可以从 iOS swift 访问 Azure blob 容器
问题描述
我想检查我是否可以成功访问 iOS Swift 中的 Azure 容器。因此,我使用AZSCloudBlobContainer.exists(completionHandler: (Error?, Bool) -> Void)
函数进行服务调用以检查容器是否存在。但是,它总是告诉我容器不存在,即使我可以列出/添加/删除该容器中的 blob。我误解了这个功能吗?以及检查访问权限的正确方法是什么。谢谢
import AZSClient
let containerURL = "https://<account>.blob.core.windows.net/<container>?st=2019-08-07T18%3A50%3A07Z&se=2019-08-09T18%3A50%3A00Z&sp=racwl&sv=2018-03-28&sr=c&sig=<signature>"
var error: NSError?
var container = AZSCloudBlobContainer(url: URL(string: containerURL)!, error: &error)
container.exists(completionHandler: {(error:Error?, exist:Bool)->Void in
print("does the contaienr exist? \(exist)")
})
解决方案
推荐阅读
- json - 为每个 REST API 响应美化或返回漂亮的 JSON 响应
- c++ - 有没有办法将整数变量数组存储到另一个数组的单个元素中?
- mongodb - 带有 OR 条件的 MongoDB Atlas 搜索过滤器范围
- javascript - 通过 array_to_json 检索的 Postgresql 数组需要转换回 Javascript 中的对象数组
- r - 将宏添加到刻面标签中的字母
- android - 为什么 View 上的 `onDraw()` 方法接收可为空的画布
- python - 如何在 Python 中使用以太坊私钥签署消息?
- flutter - 如何在 Flutter 中使用本地通知打开某个页面?(不是 FCM)
- c++ - 如何为模板实例使用容器
- python - /api/questions/ 'list' 对象的 TypeError 不可调用