【发布时间】:2012-02-19 15:33:02
【问题描述】:
使用 presentModalViewController 和 UIImagePickerController 导致 iOS 5 崩溃(在版本
float version = [[[UIDevice currentDevice] systemVersion] floatValue];
if(version < 5)
imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
else
imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
//imgPicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self presentModalViewController:imgPicker animated:YES];
【问题讨论】:
-
在使用 iOS 5 时会在此行崩溃:[self presentModalViewController:imgPicker animated:YES];
-
崩溃消息/异常信息是什么?
-
我也有同样的问题(iOS5、iPad、Landscape)。展示 UIImagePickerControllerSourceTypeCamera 工作得很好,但 UIImagePickerControllerSourceTypePhotoLibrary 和 UIImagePickerControllerSourceTypeSavedPhotosAlbum 不行。您找到解决方案了吗?
-
我发现另一篇帖子说你呈现的
UIImagePickerController应该作为变量存储在呈现类中,以防止它被过早释放。不幸的是,这对我没有帮助...... -
这解决了我在 iPad 上的问题。它确实需要创建为弹出框:stackoverflow.com/questions/9015155/…
标签: objective-c ios5 xcode4.2 uiimagepickercontroller