List of Useful Libraries for iOS Projects

Since the beginning, I used to surf the web looking for iOS libraries to help me when starting a new project.

In almost 5 years, I found out that a list of useful libraries sometimes saves me a lot of time.

Here you can find the current list of the libraries that I use to include when needed, divided by categories:

A Simple APN Server With Sinatra

In the last few days, I played a lot with APN servers to deal with push notifications for thirdy party apps and MDM. After a couple of days, during my spare time, I built a quick and basic APN server, based on Sinatra and Grocer gem… of course I’m talking about Ruby.

Log All Messages in Objective-C

Sometimes we really need to log all messages that are sent in our applications, for iOS or Mac OS. Unfortunately this is not really simply to do and Apple disabled some cool stuff in iOS to prevent a reverse engineer of their frameworks.

Matias One - I Love It!

The first thing I thought when I saw the video about Matias One Slim for the first time was: this is a great idea!

So, after a couple of months I decided to order the Matias One Slim, for Mac, of course. The keyboard was sold out since months and new shipments were expected for late February. I ordered it from U.S.A. less than 10 days ago and my keyboard is now here (thanks to Swiss customs that slowed the shipment process, of course).

Generally, I’m a big fan of Apple keyboard, even the slim makes me feel really comfortable. Matias also produce a copy of the old Apple keyboard, the Matias Tactile Pro that I tested a couple of years ago and was simply amazing. One of the greatest mechanical keyboards I’ve ever tried, but this post is about the One Slim.

Core Data Auto Increment

Core Data is a very powerful entity framework, it’s something very useful that saves a lot of time while working with complex data schemas and persistence. Sadly there are still features that are missing, like and auto-increment option for a property of an entity.
Sometimes is very useful having an auto-increment property and one solution to do it is subclassing the method awakeFromInsert that is called each time a new entity is created and inserted.

So this is the code for the magic (using an order field and MagicalRecord):

- (void)awakeFromInsert
    NSInteger tempID = ([[[MyObject MR_findAllSortedBy:@"order" ascending:YES] lastObject] order])?[[[[MyObject MR_findAllSortedBy:@"order" ascending:YES] lastObject] order] intValue]+1:0;
    [self setOrder:[NSNumber numberWithInt:tempID++]];
    [super awakeFromInsert];

Quick explanation:
It’s mandatory retriving the highest value of order inside the database, once this has been done, we can increment this value by one and then set it to our new entity manually.
This process of course works even without MagicalRecord and needs a couple of more steps with NSFetchRequest, but nothing too complicate.

Import Contacts From iPhone to Simulator

I really hate the fact that the simulator comes without the auto-import of the address book library.

If you have a project that access the contact library is really a huge problem creating a decent fake library, it takes too much time. I found out a really nice solution to import the current data from the iPhone (or iPad) to the Simulator that I want to share. This solution works even if you’ve not a jailbroken phone. It’s quick and with zero risks.

Disable Time Machine’s Local Snapshots

Today I had this strange problem: deleting files without gaining free space and having it decreasing with no sense. I started investigating what the hell was going on on my Macbook Air and, after half an hour of investigation, I figured it out: Time Local Snapshots!

JSON Libraries for iOS Comparison [Updated]

Yesterday I spent some time creating a simple test for JSON libraries and I wrote a quick article about it.

After few hours since the article has been published, I had a lot of visits on my blog, so I decide to improve the quality of the code and invest some time in getting more accurate results.

JSON Libraries for iOS Comparison

I think is one of the most common questions for an iOS developer:
Which one is the best JSON library?

I think the best test that we can do is a quick benchmark, even if I think that it’s not only the speed that makes a library better than others.

So, today I decided to do a quick performance project to check which of the following libraries is the best one in terms of speed:

To do this quick test (at the moment I’m only deserializing the JSON file) I create a project with all the libraries.
I also created 3 different kind of JSON file:

  1. A JSON file from public Twitter timeline
  2. A random JSON file generated with 1000 records with variable objects *
  3. A classic JSON file with 100 records with 2 objects *

To generate the files marked with * I used this nice online tool:

For the test I used an iPhone 4S with iOS 5.0.1.
I’ll redo the test as soon as possible with an iPhone 4, iPhone 3GS and iPad 2.

This post has been updated with more accurate results!

SQL for Swiss Towns and Cantons

I’m developing this fantastic app that needs Towns and Cantons in Switzerland and I found out that an SQL script to import these information was missing. So I decide to create a repo in GitHub and add these 2 scripts. Now you can use them when and where you want for any kind of project.

You can find the repo in Github :)