2

这似乎是UIImagePickerControlleriOS 5 中的一个问题。

我有一个开发的应用程序 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。

你..?&如何解决这个问题..?

4

1 回答 1

2

试试这个并检查:

- (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];
于 2012-12-24T09:57:31.160 回答