Using AZSClient with pictures RRS feed

  • Question

  • Hello,

    I am trying to fetch picture data in my ios app with downloadtodatawithcompletionhandler method, unfortunately the data is always empty (nil).   I tried the BlobSample from GitHub using downloadtoText method. Its just working with text blobs (tested with an rtf document). The goal is to achieve data downloading with png files. 

    The sample app already states the following:

    Additional notes: - Currently, the samples contain no error-handling code whatsoever. The most likely sources of error are: - Blobs that are not text (this may confuse the sample)

    Thanks in advance!

    Best regards

    Saturday, October 8, 2016 1:11 PM

All replies

  • Hello,

    Thank you for posting on the Azure forums!

    We are checking on this query. Kindly allow us some time to revert. We appreciate your time and patience.



    Sunday, October 9, 2016 9:47 AM
  • I got it working for downloading zip files from Azure. I hope this code helps... :-)


        NSError *accountCreationError;


        // Create a storage account object from a connection string.

        AZSCloudStorageAccount *account = [AZSCloudStorageAccount accountFromConnectionString:@"<<<yourconnectionstring>>>" error:&accountCreationError];



            NSLog(@"Error in creating account.");



        // Create a blob service client object.

        AZSCloudBlobClient *blobClient = [account getBlobClient];


        // Create a local container object.

        AZSCloudBlobContainer *blobContainer = [blobClient containerReferenceFromName:@"<<<containerName>>>"];


        // Create a local blob object

        AZSCloudBlockBlob *blockBlob = [blobContainer blockBlobReferenceFromName:@"CorporateBook.zip"];


        // Download blob

        [blockBlob downloadToDataWithCompletionHandler:^(NSError *error, NSData *dataBlob) {

            if (error) {

                NSLog(@"Error in downloading blob");


            else {

                NSLog(@"---->>> file downloaded %@",dataBlob);

                // construct path within our documents directory

                NSString *applicationDocumentsDir =

                [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];

                NSString *storePath = [applicationDocumentsDir stringByAppendingPathComponent:@"downloadedFile.zip"];


                // write to file atomically (using temp file)

                [dataBlob writeToFile:storePath atomically:TRUE];





    Sunday, November 6, 2016 9:19 AM