views:

37

answers:

1

I have a UIImagePickerController that lets the user pick an image from their library, edit it, and then save the product out to disk. Before it saves, however, I need to update a UIImageView to hold the edited photo. But when I go to set the UIImageView's image property, the program crashes. It still can save to disk.

The UIImageView is an IBOutlet and the dimensions are 88x88, if anybody cares.

I can reproduce this issue on a device (iPhone 3GS running iOS4) and in the simulator (iOS 4).

A: 

Don't you know what the error is? Especially in iOS4 you should see an entire stack trace in your log.

Most likely culprit would be a bad Interface Builder link... from there you should do retain count on your actual UIImage to see where it is when you assign it to the ImageView...

Anything after that, I suspect, would be application specific.

Jasconius
i have tried removing it from IB and creating it programatically and that didnt work. I also checked the retain count and it was 1. The app proceeded to crash. What should I do now?
agentfll
and the error is, im pretty sure, EXC_BAD_ACCESS
agentfll
also, that very same image can be converted to NSData and saved to disk. That works.
agentfll
Where does the UIImageView come from? To rule out your image as the problem, replace the UIImageView.image assignment by something failsafe like [UIImage imageNamed:@"..."]
mvds
which reminds me: doing image stuff on an iphone results in a lot of didReceiveMemoryWarnings, which, when not properly handled, might unload your UIImageView, resulting in EXC_BAD_ACCESS. put in a -(void)didReceiveMemoryWarning{NSLog(@"Ha! NOT unloading");} and see what happens.
mvds