How CMLibrary developed by Net Solutions speeds up iOS apps for you?

CMLibrary developed by Net Solutions_f

As you would probably know, a lot of code programmers write is re-usable. Small parts of such code are known as snippets and several snippets can be combined to form a library. Snippets and libraries of re-usable code help avoid rework each time a new program or application is written as you can insert snippets instead of rewriting code.

At Net Solutions, we build iOS applications often. Most of those who build such apps use web services to send and retrieve data. Adding such functionality to the apps means having to write a lot of code over and over again, unless you create snippets or even a library of re-usable code. That is how the idea for CMLibrary or content management library came up.

It lets you insert 4-5 lines of code instead of rewriting 15-20 lines each time you enable an iOS app to send and retrieve data through web services. You can download and upload large-sized files or content with memory efficiency. CMLibrary also allows for caching of information.

In what ways CMLibrary is really unique?

CMLibrary provides ease of use and memory efficiency and there are no memory leaks. The library supports JSON and XML, among other formats. That is why this Arc-based library stands out among the mostly manual-based libraries available in the market.There are other such libraries available in the market. However, most of those are not for free or not memory efficient.

How does CMLibrary help delivering apps faster?

  • The library speeds up the process of building iOS apps.
  • The technology is fast, memory-efficient and not prone to memory leaks.
  • It supports caching.
  • It helps large amounts of data travel between the app and the server without glitch, thus improving the UI and UX of the apps.
  • The library supports data formats such as JSON, XML, etc.

The problem that this technology solves – Real-world examples

In most iOS-app projects, you have to use web services to get data from and post data to a server. Simply put, you have to write code in all the classes where data comes from the server. If there are many formats in use in the project, such as JSON and XML, you have to write different code for the same purpose for each of the different types.

You have to add the following in each class to reach the web service and get a response:

// Create the request

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@””]];

// Create url connection and fire request

NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];

//NSURLConnection Delegate Methods

– (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {

// A response has been received, this is where we initialize the instance var you created

// so that we can append data to it in the didReceiveData method

// Furthermore, this method is called each time there is a redirect so reinitializing it

// also serves to clear it

_responseData = [[NSMutableData alloc] init];


– (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {

// Append the new data to the instance variable you declared

[_responseData appendData:data];


– (NSCachedURLResponse *)connection:(NSURLConnection *)connection

willCacheResponse:(NSCachedURLResponse*)cachedResponse {

// Return nil to indicate not necessary to store a cached response for this connection

return nil;


– (void)connectionDidFinishLoading:(NSURLConnection *)connection {

// The request is complete and data has been received

// You can parse the stuff in your instance variable now


– (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {

// The request has failed for some reason!

// Check the error var


In CMLibrary, you don’t have to use these delegate methods in each class. You just have to add the following in a class:

WebserviceCall *webserviceCall = [[WebserviceManager sharedInstance] getWebserviceCallObjectWithDelegate:self withResponseType:WebserviceCallResponseJSON cachePolicy:WebserviceCallCachePolicyRequestFromUrlNoCache];

[webserviceCall setPostDataDict:DataDict];

[[WebserviceManager sharedInstance] callWebserviceForSignInWithSuccessSelectorNotification:@selector(onWebserviceSuccess
Notification:) failureSelectorNotification:@selector(onWebserviceFailureNotification:) webserviceCall:webserviceCall];

You can use the following two methods to receive a response:

-(void)onWebserviceSuccessNotification:(NSNotification *)notification


//Contain the response data


-(void)onWebserviceFailureNotification:(NSNotification *)notification


//Show alert when some error is there

An example from an app we are working on :

Given below is a screenshot from an app known as EdPlace that we are working on. It is an education-related app and is meant to help students with subjects including mathematics.


In the given example, data for ‘level’, ‘date’, etc. is being fetched from a server using web service through CMLibrary. The caching function is also operational here and proves helpful if a user moves away from this screen and then returns to it.

Besides developers, how does CMLibrary benefit end-users

The technology facilitates large amounts of data traveling to and fro between the server and the app. So, this technology helps end-users as the user interface continues to function properly while substantial data is being fetched from or posted to the server, thus improving the user experience of the apps using CMLibrary.
Have you developed or benefited from such a technology before? Let us know in the comments section below.

Amandeep Singh

About the Author

Amandeep Singh is a self-directed and motivated technical developer with 8 years of experience in iOS technologies. Excellent at developing and maintaining iOS applications, he is an avid learner of technologies, given his strong development background. Outside of work, Amandeep likes surfing the net and listening to music.

Leave a Comment


5:04 PM, Sep 29, 2014

Good Work Sir,..Caching of the data in the library gives new edge to the application.

Pin It on Pinterest


Join our mailing list to receive alerts on latest insights, updates, and exclusive offers. No spam.