2012-12-24 50 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