在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];
}
}
答案 0 :(得分:0)
当您到达将其视图添加到ImagePicker
的行时,您无法保证cameralayer
将在内存中。创建后不要autorelease
ImagePicker
。一旦你真正使用它及其视图,只有release
。