Iphone Development Tips :unable to read unknown load command 0x80000022

Do u ever got some message like that in the debugger of Iphone? unable to read unknown load command 0x80000022? and then it will hang

Yeah, that sucks. As a newbie in the Iphone development, at the first time I have no idea how to solve the problem.

I got the message in many cases, but I keep forgetting the cause… and I’m suffering from this stupid behavior, so I’m gonna post it down to nail it on my mind.

Basically, if you got the error message like that, probably you are trying to do something below, which are stupid thing I kept trying to do:

- you want to RELEASE an object that has alreadly been released.

- you RELEASE an autoreleased object

- you try to access an object that has already been released!

-you forget to retain an object that is valuable, and and it’s located in an autorelease pool, especially in different thread.

As for my case, I try to fill an UITableView from XML reading & parsing, which is I try to achieve  from different thread, because I don’t want it to block the UI, and then when I scroll it, or when I finish the DidSelectRowIndexPath, I got the error message. It took me hours to finish it, because I know I ever got the problem, but the brilliant me KEPT FALLING in the same hole, it just like pain in love…

another tips guys, CMIIW, all objects that you assign without alloc in different thread that you detached will get released in the end… I mean, it’s not like if you create it in the main thread, e.g:

NSString *str = @”I’m punked”;

when you do that in the main thread, it stay as it is…

but when you do that in the detached different thread.. it is autoreleased in the end (since u don’t allocated something either! it is the same as autorelease object), CMIIW…

well, how to effectively debug this? well, one tool that’s useful is NSZombie !! aaw awaw… What it basically do is when you enable NSZombieEnable, It will not release the object that you sent release message, so it is useful for debugging the memory and all the release-autorelease-retain stuffs, and it will tell you exactly the location when you get crash, or Memory bax EXCESS stuff

to enable the NSZombie all you need to do from ur XCODE is:

1. double click the executable icon in the left panel

2. go to “Argument” TAB

3. in the Variables to be set in the environment, type  “NSZombieEnabled=YES”

that’s it, but beware, coz u don’t want it enabled when you ship it in the AppleStore… as it will not really release the object you’ve already sent the release message.

Another tips: try to retain object/variables/anything that has the indication that it is not available… use ur animal instinct! ;p

Or, you could do it with trial and error… and then make it as a learning curve of your brain =)

That’s all folks… forgive for my dumb post, hope it can save minutes of someone night-coding-time….

thanks.

About these ads

4 comments on “Iphone Development Tips :unable to read unknown load command 0x80000022

  1. Thx for ur post, i didn’t know that NSZombieEnabled make the object nto to be released…and i submitted an app with the zombies^^

Berikan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Logout / Ubah )

Twitter picture

You are commenting using your Twitter account. Logout / Ubah )

Facebook photo

You are commenting using your Facebook account. Logout / Ubah )

Google+ photo

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s