3
我正在使用简单的“UIImagePickerController”处理内存问题。 我得到两个记忆警告:一个在我拍照时,一个当我触摸“使用”按钮... 最好的是,这只能附加在4S(这恰好是我老板的手机) 。我甚至无法在其他型号的iPhone上重现此错误(在3G,3GS,4和5上测试)。UIImagePickerController在拍摄和选择图像时导致内存警告
我尝试不同的东西,这是这是一种能够重现该问题的最简单为例:
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.delegate = self;
[self presentModalViewController:picker animated:YES];
[picker release];
我实现委托方法:
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
[picker dismissModalViewControllerAnimated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// should do something with the [[info objectForKey:UIImagePickerControllerOriginalImage] retain];
if (picker.sourceType == UIImagePickerControllerSourceTypeCamera)
UIImageWriteToSavedPhotosAlbum(selectedImage, nil, NULL, nil);
[picker dismissModalViewControllerAnimated:YES];
}
有谁知道这个问题并希望解决方案?
非常感谢!
看到拍照时的记忆警告并不罕见。是否造成问题? – rmaddy
它可能会解释第一个内存警告,但第二个确实发生在我点击“使用”选择图像时。 –
选择使用图像仍需要一些内存来处理。你是出于好奇还是因为它造成问题而问这个问题?如果它造成了问题,您需要澄清那是什么问题。 – rmaddy