相机捕获经常使应用崩溃,没有任何线索 [英] Frequently Camera capture crashing the app without any clue
问题描述
我正在使用UIIMagePicker Controller捕获图像。相机拍摄的前30到40张照片效果很好,但是拍摄约40张照片后会导致应用崩溃。我没有在xcode上收到任何内存警告或崩溃报告。
I am using UIIMagePicker Controller for capturing image. The camera capture works fine for first 30 to 40 shots but it will crash the app after around 40 captures. I do not get any memory warning or crash report on xcode.
此问题看起来像内存泄漏,但是我监视了仪器,内存使用量没有超过60 MB。
This issue look like memory leak but i have monitored Instruments and memory use is not going more then 60 MB.
从图库中选取图片不会导致此问题。
The image pick from gallery do not cause this issue.
我正在使用的代码:-
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[MBProgressHUD showHUDAddedTo:self.view animated:true];
UIImage *chosenImage = info[UIImagePickerControllerOriginalImage];
NSDate *now = [NSDate date];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateFormat = @"MMM-dd-yyyy";
[dateFormatter setTimeZone:[NSTimeZone systemTimeZone]];
NSDateFormatter *timeFormatter = [[NSDateFormatter alloc] init];
timeFormatter.dateFormat = @"HH:mm a";
[timeFormatter setTimeZone:[NSTimeZone systemTimeZone]];
NSString *strtime=[NSString stringWithFormat:@"%@\n%@ ",[timeFormatter stringFromDate:now],[dateFormatter stringFromDate:now]];
lblTime.numberOfLines =0;
[lblTime setText:strtime];
[lblTime setHidden:YES];
imgTakenPhoto.image = chosenImage;
[btnCrossOnDentView setHidden:YES];
[btnDoneWithDent setHidden:YES];
App_Delegate.isEdited = YES;
[picker dismissViewControllerAnimated:YES completion: ^{
dispatch_async(dispatch_get_main_queue(), ^{
[MBProgressHUD hideAllHUDsForView:self.view animated:true];
imagePickerController = nil;
}); }];
}
推荐答案
这是iPhone OS问题。我还提交了有关此问题的报告。相同的代码可以在iPad上正常运行。报告错误并提交您的项目。
Its an iPhone OS issue. I also submitted a report regarding this issue. Same code will run fine in iPad. Report a bug and submit your project.
这篇关于相机捕获经常使应用崩溃,没有任何线索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!