这似乎是 iOS 5 中 UIImagePickerController
的问题。
我开发了一个 xcode4.3 的应用程序,我在两部 iPhone(iOS 4.3 和 5.1)上测试了它
{
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.view.tag = tag;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
if ( imagePicker.view.tag == 1)
{ //Editing doent allowed for biz card
imagePicker.allowsEditing = YES;
[Flurry logEvent:@"Edit Contacts:Attempt to add an image for the Contact picture using the camera"];
}
else {
[Flurry logEvent:@"Edit Contacts:Attempt to add an image for the Business Card picture using the camera"];
}
[self presentModalViewController:imagePicker animated:YES];
[imagePicker release];
}
如果设备是 iOS 4.1
拍摄照片或从库中选择照片时没有泄漏/没有内存警告(在运行 iOS 4.1 的设备上测试)。
在运行 iOS 5.1 的设备上测试相同的代码时,当从相机捕获中拍摄照片时,我经常遇到 1 级内存警告。
你..?以及如何解决这个问题..?
最佳答案
试试这个并检查:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[picker dismissModalViewControllerAnimated:YES];
}
添加此方法并检查。
也像这样添加并检查:
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.view.tag = tag;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
if ( imagePicker.view.tag == 1)
{ //Editing doent allowed for biz card
imagePicker.allowsEditing = YES;
[Flurry logEvent:@"Edit Contacts:Attempt to add an image for the Contact picture using the camera"];
}
else {
[Flurry logEvent:@"Edit Contacts:Attempt to add an image for the Business Card picture using the camera"];
}
[self presentViewController:imagePicker animated:YES completion:nil];
关于iphone - iOS 5 中 UIImagePickerController 出现内存警告,但 ios 4.x 中没有,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14019550/