UIImagePickerController crash on iOS 5

Deadly 提交于 2019-12-25 12:43:13

问题


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?


回答1:


If your app crashes as below, need to change the app's product name in English.

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




回答2:


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




回答3:


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



来源:https://stackoverflow.com/questions/7810251/uiimagepickercontroller-crash-on-ios-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!