首页 > 解决方案 > 如何检查是否可以从 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)")
            })

标签: iosswiftazureazure-blob-storage

解决方案


推荐阅读