0
UIImagePickerController *ii_picker= [[UIImagePickerController alloc] init];
ii_picker.delegate=self;
ii_picker.sourceType=UIImagePickerControllerSourceTypeCamera;
add_photo=NO;
[self presentModalViewController:ii_picker animated:YES];
[ii_picker release]; 

This used to work fine till I updated to iOS 5 on my iPhone. Something strange...

Problem isn't in the code. It's working in blank project! If I paste it to any place in my project's code, it's crashing. If I change UIImagePickerControllerSourceTypeCamera to UIImagePickerControllerSourceTypeSavedPhotosAlbum, it's working in iOS5.

Does anybody know where the problem is?

vikingosegundo
  • 52,040
  • 14
  • 137
  • 178
Gralex
  • 4,285
  • 7
  • 26
  • 47

3 Answers3

1

If app is crashes in iOS 5 , then try to use

 [self dismissModalViewControllerAnimated:YES];
 picker = nil ;

In place of [[picker parentViewController] dismissModalViewControllerAnimated:YES]; [picker release];

MrWaqasAhmed
  • 1,479
  • 12
  • 12
0

If your app crashes as below, need to change the app's product name in English. https://i.stack.imgur.com/j1m6f.png

In my case product name was written in Korean, this led to the crash in ios5 when UIImagePickerController's source type is UIImagePickerControllerSourceTypeCamera.

Dongjin Suh
  • 448
  • 4
  • 12
-1

Note, on the simulator, there's no camera, so it could cause this.

akaru
  • 6,299
  • 9
  • 63
  • 102
  • Ah, such negativity. Sometimes the simplest solution is the right one. Though I should have left this as a comment I realize. – akaru Sep 22 '12 at 20:47