iOS: Using NSArray arrayWithObjects? iOS 8.1 might have something to say

Today I decided to fix some bugs on the oaSES Online iPhone app. I wrote this application back in 2012 and it performed beautifully, a real success.

Since then I have been working on a lot of other projects but since iOS 8 came out, we noticed that a lot of components in our app were crashing.

So, today I went after it. After enabling Zombie mode and doing some profiling I saw the problem was because we were accessing objects that been released by iOS's ARC. Problem is that this has always worked, and it just now started to fail with iOS 8, so obviously something changed.

Anyways, we were more after the solution than the explanation, after tracking down the released objects, we noticed how we were initializing them:

[NSArray arrayWithObjects:section1, section2, nil]

After doing some research the proper way to initialize them and avoid issues like the one we faced is to initialize like this:

[[NSArray alloc] initWithObjects: section1, section2, nil]

If you are running into issues with your app with EXC_BAD_ACCESS, and still haven't been able to figure out the cause, take a look at your object initialization, it's probably there.

Until next time.