简体   繁体   English

在相机模式下呈现UIImagePickerController会导致iOS 7崩溃

[英]Presenting UIImagePickerController in camera mode causes crash in iOS 7

At the time of presenting UIImagePickerController in camera mode using the code below, Xcode 5 memory view shows that my app consumes about 20 MB. 在使用下面的代码以相机模式呈现UIImagePickerController时,Xcode 5内存视图显示我的应用程序消耗大约20 MB。 When I present the controller, I receive memory warning in the overrode didReceiveMemoryWarning. 当我呈现控制器时,我在overrode didReceiveMemoryWarning中收到内存警告。 But even without a chance to release any resources in there, the app just crashes without leaving any log messages. 但即使没有机会在那里释放任何资源,应用程序也会崩溃而不会留下任何日志消息。 I am running the code in an iPhone 4S. 我在iPhone 4S中运行代码。 I see other similar questions but the symptoms are slightly different than mine and I don't see any clear answers that led to resolving my issue. 我看到其他类似的问题,但症状与我的略有不同,我没有看到任何明确的答案导致解决我的问题。 The same code does not cause a problem in iOS 6 or when I present the controller in photo library mode. 相同的代码不会在iOS 6中或在照片库模式下呈现控制器时出现问题。 My specific questions are: 我的具体问题是:

  1. Would it be normal to get memory warning with about 20 MB memory usage when presenting UIImagePickerController in camera mode? 在相机模式下呈现UIImagePickerController时获取大约20 MB内存使用量的内存警告是否正常?

  2. Should I deal with this problem by reducing the memory consumption level further before I present the UIImagePickerController? 我应该通过在呈现UIImagePickerController之前进一步降低内存消耗水平来解决这个问题吗?

=== ===

- (IBAction)cameraClicked:(id)sender
{
    UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
    imagePicker.delegate = self;
    imagePicker.navigationBarHidden = YES;
    imagePicker.toolbarHidden = YES;
    imagePicker.allowsEditing = NO;

    imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;  
    [self presentViewController:imagePicker animated:YES completion:nil];
}

What is the error you are getting is it ? 你得到的错误是什么? EXC_BAD_ACCESS Try to debug with NSZombieEnabled available in instruments and also Symbolic and exceptional breakpoints so that you can trace the reason for the crash. EXC_BAD_ACCESS尝试使用仪器中可用的NSZombieEnabled以及符号和特殊断点进行调试,以便您可以跟踪崩溃的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM