When trying to show the UIImagePickerController I had strange problems with my app crashing on iOS4. Here's the output from log:
malloc: *** error for object 0x550ba20: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Setting breakpoints, trying to spy the name of the object 0x550ba20 (with print-object) does not work. Enabling zombie detection also does not work. Here is my code:
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
cameraPicker = [[UIImagePickerController alloc] init];
cameraPicker.delegate = self;
cameraPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
// Insert the overlay:
cameraPicker.cameraOverlayView开发者_开发技巧 = self.overlay;
self.cameraPicker.delegate = self;
//Hide controls
cameraPicker.showsCameraControls = NO;
cameraPicker.navigationBarHidden = YES;
// Make camera view full screen:
cameraPicker.wantsFullScreenLayout = YES;
cameraPicker.cameraViewTransform = CGAffineTransformScale(self.cameraPicker.cameraViewTransform, 1.0, 1.12412);
[self presentModalViewController:cameraPicker animated:NO];
[cameraPicker release];
Any ideas? Code is executed at the very end of viewDidLoad.
Is cameraPicker a property? You are initializing it first as a local variable and then using it as a property:
cameraPicker.cameraOverlayView = self.overlay;
!!self.!!cameraPicker.delegate = self;
and
cameraPicker.cameraViewTransform = CGAffineTransformScale(!!self.!!cameraPicker.cameraViewTransform, 1.0, 1.12412);
精彩评论