UIImagePickerController在iOS4上崩溃

时间:2010-10-01 09:34:21

标签: iphone ios4 uiimagepickercontroller

当试图显示UIImagePickerController时,我的应用程序在iOS4上崩溃时遇到了奇怪的问题。这是log:

的输出
malloc: *** error for object 0x550ba20: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

设置断点,试图监视对象名称0x550ba20(使用print-object)不起作用。启用僵尸检测也不起作用。这是我的代码:

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];

有什么想法吗?代码在viewDidLoad的最后执行。

1 个答案:

答案 0 :(得分:0)

cameraPicker是属性吗?您首先将其初始化为局部变量,然后将其用作属性:

cameraPicker.cameraOverlayView = self.overlay;
!!self.!!cameraPicker.delegate = self;

cameraPicker.cameraViewTransform = CGAffineTransformScale(!!self.!!cameraPicker.cameraViewTransform, 1.0, 1.12412);