iphone - iOS 5 中 UIImagePickerController 出现内存警告,但 ios 4.x 中没有

标签 iphone objective-c ios5 ios4 uiimagepickercontroller

这似乎是 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/

相关文章:

iphone - 单击导航栏时 UIPopoverController 不会关闭

iphone - 如何让scrollViewDidScrollToTop 在 UITableView 中工作?

iphone - 使用 ifstream 读写二进制字符串的正确格式

ios - 如何使用宽度缩放 UIImage 并保持比例

iphone - MapKit 由于未捕获的异常而终止应用程序无效区域

iphone - 适用于 iOs 7 的特定 StoryBoard

objective-c - Objective C 中的递归数据类型和类型

ios - 在 uicollectionviewcell 中设置文本

objective-c - 在字符串前面添加空格?

ios - 使用 Apple 推送通知服务推送应用程序更新