EXC_BAD_ACCESS on thumbnail setting


#1

I’ve progressed to the end of Chapter 16 with everything working except the image on the ItemsView Controller. I receive a EXC_BAD_ACCESS error when I try to run the application after adding the code specified in the chapter. Using the debug window and some NSLogs, the code fails on the following line:
thumbnail = [[UIImage imageWithData:thumbnailData] retain];

In the Debugger, I see the following (in the order below)
__memcpy
_BindToPlugin
CGImageSourceGetCount
_UIImageRefFromData
-[UIImage initWithData:]
+[UIImage imageWithData:]
-[Possession thumbnail]
-[HomepwnerItemCell setPossession:]
< < < etc > > > >

Has anyone else encountered this issue?
I’m using Xcode 3.2.6 with Simulator 4.3. Could this be causing this type of issue?

Thanks for any assistance!


#2

So I’ve continued debugging this issue with no luck.

First, I created a new Xcode project and copied in the files from the Big Nerd Ranch Answer zip file. This project ran fine–I was able to create a few Possessions and add a picture, then see the pictures on the ItemViewController. The only oddity on this was that I closed Simulator and re-launched it. I was back at a blank screen and had to add Possessions again–they did not persist across runs. But not a big deal since Im able to get the Possessions to persist in my app.

Then, one by one, I transferred in the class files from the Answer zip to my project, recompiled, and tested. No luck–still getting EXC_BAD_ACCESS issue after testing each file individually.

Then I tried copying over ALL class files from the Answer Key (which worked in the first test above) into my project. No luck–still get EXC_BAD_ACCESS issue.

At this point, if the issue isn’t due to a specific class file (ruled out in previous step), then it must be something in the definition of the project itself. I used Terminal to dig into the xcodeproj files–there’s nothing that jumps out at me but I’m also not vary familiar with these specific files.

If anyone has an further suggestions, please let me know. I’d really like to determine the cause of the issue.
Thanks!


#3

Hi,

Just wondering if there is some dodgy data lurking around from previous attempts.

Have you tried deleting the app from the device / simulator to get rid of all the data and rebuilding the app ?

Gareth


#4

Thanks, Gareth! That worked. It hadn’t occurred to me that the data could have been messed up with all of the rebuilds.