2012-12-24 43 views
2

这似乎是iOS 5中UIImagePickerController的一个问题。在iOS 5中使用UIImagePickerController但在ios 4.x中未使用内存警告

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

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

+0

分享到拍照相关的一些代码... – Vishal

回答

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]; 
+0

alrdy我用它来解雇选择器 – user1811427

+0

修改我的答案检查工作或没有? – Vishal

+0

笏是在mycode和您的代码差异... – user1811427