Search
Rich's Mad Rants
Powered by Squarespace

Creating iOS 5 Apps Discussion > SIGABRT and release question

I posted this a couple of days ago but something must have gone wrong.

Toward the end of chapter 6 (what a slog of a chapter) you show two release calls in the 'undo' method. ARC doesn't allow this. Am I doing something wrong?

Also, when running the simulator deleting a weight entry gives me a sigabrt error and the app crashes. thoughts?

Thanks,

Paul

March 4, 2012 | Unregistered CommenterPaul

Paul,

Sorry it's taken so long to get back to you. I'm still struggling to get caught up after two trips and a week of illness.

Yep, Chapter 6 is a bit of a beast. While UIDocument makes iCloud syncing easier than it would otherwise be, it's still not easy.

The first question is easy. That was a mistake. I originally wrote the project for iOS 4, and thought I removed all the extra retain and release calls--but apparently I missed a few. I've listed all the ones that I have heard about in the book's FAQ. I actually had these listed, but I had the page numbers wrong. It's fixed now.

Simply delete the lines saying [alert release];

The next question is harder. Sigbart's typically happen when accessing an invalid piece of memory. Objective-C protects us from this in many cases: uninstantiated instance variables are set to nil, and we can send messages to them without causing errors (it won't do anything--but it won't crash). However, there are other ways to get into trouble. If you directly access a nil-object's instance variables, you'll likely cause a sigbart. You could also define an uninstantiated local object variable--these are not set to nil, so calling methods on them would sigbart. You might also get into trouble accessing values in C scalars or structs.

It's hard to know what the exact problem is. My recommendation is to set a breakpoint in the code that responds to the delete event. Run the app again, and walk through the code a step at a time, until you find the exact spot where it crashes. You'll probably find a variable with an uninstantiated value.

Good luck,

-Rich-

March 7, 2012 | Registered CommenterRichard Warren