0

在 iOS7 上运行以下命令时,我的应用程序崩溃。它在 iOS6 上运行良好

UIImagePickerController *ImagePicker;

@try {
   ImagePicker = [[[UIImagePickerController alloc]init]autorelease];
   ImagePicker.sourceType= UIImagePickerControllerSourceTypeCamera;
   ImagePicker.showsCameraControls = NO;
   ImagePicker.toolbarHidden = YES;
   ImagePicker.navigationBarHidden= YES;
   //  ImagePicker.wantsFullScreenLayout = YES;

   ImagePicker.cameraViewTransform = CGAffineTransformScale(ImagePicker.cameraViewTransform, CAMERA_TRANSFORM, CAMERA_TRANSFORM);  
}
@catch (NSException *exception) {
    [ImagePicker release];
    ImagePicker = nil;
}
@finally {

    if(ImagePicker)
    {
        [cameralayer addSubview:[ImagePicker view]];
        [cameralayer release];
    }

}
4

1 回答 1

0

您不能保证ImagePicker当您到达将其视图添加到cameralayer. 不要autorelease ImagePicker在你创建它之后。只有release当你真正完成使用它和它的视图时才会使用它。

于 2013-10-09T17:18:33.237 回答