当我要求使用PhotoAlbum中的照片显示imagePicker时,我会崩溃:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </var/mobile/Applications/9D75B5EC-6CC9-4306-B4A1-88C369FEEC6C/AlterGeo.app> (loaded)' with name 'PLUIPrivacyViewController''
- (void)showImagePicker {
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
if ([imagePicker respondsToSelector:@selector(setAllowsEditing:)]) {
[imagePicker setAllowsEditing:_editable];
}
[imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[imagePicker setDelegate:self];
[[self getNavigationController] presentModalViewController:imagePicker animated:YES];
[imagePicker release];
}
- (UINavigationController *)getNavigationController {
if (_delegate && [_delegate isKindOfClass:[UIViewController class]]) {
return [(UIViewController *)_delegate navigationController];
}
return nil;
}
如果它首次启动并且i ios要求权限(UIAlertView允许/拒绝)它将崩溃,但如果我已经授予许可(允许)它将正常工作。 我怎么解决它?
答案 0 :(得分:0)
我找到了解决问题的方法。 代码不是我的,它是外包人员奇怪的项目重新设置..无论如何,他们要求UiViewController类别中的每个ViewController xib文件
- (NSString *)nibName {
if ( ! [NSStringFromClass([self class]) isEqualToAnyString:[NSArray arrayWithObjects:
@"UIStatusBarViewController",
@"UIZoomViewController",
@"PLUIPrivacyViewController",
nil]]) {
return NSStringFromClass([self class]);
}
return nil;
}
并且在ios6.0中苹果添加了PLUIPrivacyViewController whitch没有自己的nib ..我只是在异常中添加PLUIPrivacyViewController .. Ofcource更好的方法来制作白名单的控制器6因为该项目真的很老,不会修改,但苹果可以添加一些其他控制器没有笔尖... 但是很多时候。