Skip to content

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

@AbiramiBala

Description

@AbiramiBala

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions