Ios N在照相机模式下显示UIImagePickerController时出现内部一致性异常,但在照片库模式下工作正常
我试图在运行iOS 7的iPhone 4上演示一个带有Ios N在照相机模式下显示UIImagePickerController时出现内部一致性异常,但在照片库模式下工作正常,ios,camera,uiimagepickercontroller,uiactionsheet,Ios,Camera,Uiimagepickercontroller,Uiactionsheet,我试图在运行iOS 7的iPhone 4上演示一个带有sourceType UIImagePickerController源类型摄像头的UIImagePickerController。它可以使用默认的sourceType(照片库)显示而不会出现问题,但是当我尝试以相机模式显示它时,它会崩溃,出现nsinternalinconsistenceexception: Terminating app due to uncaught exception 'NSInternalInconsistencyEx
sourceType UIImagePickerController源类型摄像头的UIImagePickerController
。它可以使用默认的sourceType
(照片库)显示而不会出现问题,但是当我尝试以相机模式显示它时,它会崩溃,出现nsinternalinconsistenceexception:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "vXZ-lx-hvc-view-kh9-bI-dsS" nib but didn't get a UITableView.'
我正在显示UIImagePickerController
的UIViewController中使用UITableView
,但我不清楚为什么会出现UITableViewController
错误。我已将所需的代理分配给UIViewController
(UIImagePickerController远程闸门、UIActionSheetDelegate、UINavigationController远程闸门)
以下是我从UIActionSheet
中演示UIImagePickerController
的代码:
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(buttonIndex == 0)
{
//[self.tableView resignFirstResponder];
_myPicker = [[UIImagePickerController alloc] init];
/*
[_myPicker setSourceType:UIImagePickerControllerSourceTypeCamera];
[_myPicker setShowsCameraControls:YES];
[_myPicker setEditing:YES];
[_myPicker setNavigationBarHidden:YES];
[_myPicker setDelegate:self];
*/
_myPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
_myPicker.showsCameraControls = YES;
_myPicker.editing = YES;
_myPicker.navigationBarHidden = YES;
_myPicker.delegate = self;
//self.myPicker = _myPicker;
[self presentViewController:_myPicker animated:YES completion:nil];
}
else if(buttonIndex == 1)
{
_myPicker = [[UIImagePickerController alloc] init];
[self presentViewController:_myPicker animated:YES completion:nil];
}
}
\u myPicker
在界面中声明为:
@property(nonatomic)UIImagePickerController *myPicker;
并在实施中进行了综合:
@synthesize myPicker = _myPicker;
有人能发现我在这里做错了什么吗?错误消息表明,当您从情节提要加载UITableViewController
时,view controller的view
属性未设置为UITableView。由于此处没有加载UITableViewController
,因此问题似乎不太可能出现在任何代码中。您做了什么来隔离此代码的问题?我尝试从此视图控制器中删除UITableView和所有关联的IB连接。由于这个做演示的类是一个UIViewController,我想知道为什么它要寻找一个UITableView作为view属性。它不应该只是一个UIView吗?看起来好像在某个地方,当您进行这些更改时,您忘记将某些内容设置回UIViewController
,因为在某个地方它肯定正在加载一个UITableViewController
,您知道为什么它会加载带有默认源类型(照片库)的UIImagePickerController吗没有任何问题吗?没有任何线索,正如我在第一篇评论中提到的,它似乎真的不太可能与您实际发布的代码有任何关系。