Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting - com.microsoft.azure.storage.errordomain error 2 - error when accessing Blob container #117

Open
AbiramiBala opened this issue Dec 1, 2023 · 0 comments

Comments

@AbiramiBala
Copy link

Latest SDK and latest iOS version used. My app is designed for iPAD and is used and installed via secured VPN connection using an MDM.

When Im trying access blob container i'm getting this error
The operation couldn't be completed (com.Microsoft.AzureStorage.ErrorDomain error 2)

This is happening intermittent on only few devices. I can see the customer screenshots with the above error message. An im unable to reproduce from our test devices where it is working fine. For your reference my code is as below.

    var imageName = String()
    let aStrTimeStamp = "\(Date().getTimeStamp())"

    imageName = "ipad" + "_" + aStrInviteId + "_" + K_BLOB_TYPE_NAME_SIGNATURE + "_" + aStrTimeStamp + ".png"
    
    let connString = **My Connection String**  
    let container = **My container name** (ex: live-xxxx-signature)
    
    do {
        let account = try AZSCloudStorageAccount(fromConnectionString: connString)
        let blobClient: AZSCloudBlobClient = account.getBlobClient()
        let blobContainer: AZSCloudBlobContainer = blobClient.containerReference(fromName: container)
        blobContainer.createContainerIfNotExists(with: AZSContainerPublicAccessType.container, requestOptions: nil, operationContext: nil) { (NSError, Bool) -> Void in
            if ((NSError) != nil){
                print("Error in creating container.")
                DispatchQueue.main.async {
                    HELPER.showDefaultAlertViewController(aViewController: self, alertTitle: "Sorry unable to upload, Please try again later", aStrMessage: NSError?.localizedDescription ?? "")
                }
                HELPER.hideLoadingAnimation()
            }
            else {
                let blob: AZSCloudBlockBlob = blobContainer.blockBlobReference(fromName: imageName) 
                
                blob.upload(from: imageData!, completionHandler: {(NSError) -> Void in
                    print("Ok, uploaded !")
                    
                    HELPER.hideLoadingAnimation()
                    let presignedURL = ProductFile().getS3BucketEndPoint() + container + "/" + imageName    
                    print(presignedURL)                    
                })
            }
        }
    } catch {
        HELPER.hideLoadingAnimation()
        print("Error in uploading and creating container.")
    }

Please help me in this case , I'm struggling for the last one week. Your quick response is much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant