Posted by on Oct 5, 2015 in #Azure, #iOSDev, Xcode | 0 comments

If you didn’t know yet there’s an Azure Storage Client Library for iOS available on GitHub:
https://github.com/Azure/azure-storage-ios

It’s currently in preview but does support almost all of the block blob operations. While we are working on supporting more blob types (page, append) and services (table, queue, file) – you can check this one out and give us feedback in the meantime.

1. Clone the library
The first thing you want to do is to download the library onto your machine – it’s easily done with git. If you would like to follow along with this post, go ahead and download it to your desktop (we will need to configure a search path later for locating the library during build time).

Launch your terminal and run the following:

git clone https://github.com/Azure/azure-storage-ios.git

Screen Shot 2015-10-05 at 22.51.21

2. Build the library
Next up navigate into the downloaded folder and find the Xcode project file (*.xcodeproj, in the Lib folder) – launch it.

Before building the project make sure to build for the “Framework” target.

Screen Shot 2015-10-05 at 22.52.22

After you have built the project, you should find the framework file (*.framework) located on your desktop.

3. Link the library
Launch your own Xcode project and head into the properties of it.

In the “Build Phases” tab, find the “Link Binary With Libraries” section and hit the plus sign. Use the “Add Other…” button to browse your machine for the framework file (*.framework) that you just built.

Screen Shot 2015-10-05 at 22.53.37

You will also need to add the libxml2.2.tbd framework (used by the Azure Storage Client Library).

Screen Shot 2015-10-05 at 22.54.26

4. Configure search path
In order to build correctly, you need to tell Xcode where to find the library during build time.

This can be done via the “Build Settings” tab. Filter by “All” of the settings and find the “Search Paths” section. In here you will need to set “Always Search User Paths” to Yes and add a “Framework Search Path”. Enter ~/Desktop/ and make sure it’s set to recursive – we need to make sure that the compiler digs down into the various folders for the libraries.

Screen Shot 2015-10-05 at 22.55.37

5. Import the header
Finally, pull in the library header file into your code like so:

#import “Azure Storage Client Library/Azure_Storage_Client_Library.h”

Compile your project and you will now be able to code for Azure Storage.

Screen Shot 2015-10-05 at 22.56.11

Learn more about the library and find samples at the GitHub repository.

Happy coding!
-Simon Jäger