【问题标题】:PLUIPrivacyViewController and Access to photo libraryPLUIPrivacyViewController 和访问照片库
【发布时间】:2013-02-22 13:46:58
【问题描述】:

当我要求使用 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;
}

如果它第一次启动并且我的 ios 请求权限(UIAlertView 允许/拒绝)它会崩溃,但如果我已经授予权限(允许)它会正常工作。 我该如何解决?

【问题讨论】:

    标签: ios objective-c uiimagepickercontroller photo


    【解决方案1】:

    我找到了我的问题的解决方案。 代码不是我的,它是对项目有奇怪影响的外包人员.. 无论如何,他们要求 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 没有自己的笔尖。我只是在异常中添加 PLUIPrivacyViewController 。 Ofcource 更好的方法来制作控制器的白名单6因为项目真的很旧并且不会修改,但是苹果可以添加一些其他没有笔尖的控制器...... 但它有很多时间。

    【讨论】:

      猜你喜欢
      • 2020-09-07
      • 1970-01-01
      • 2017-10-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-02
      • 2015-10-31
      相关资源
      最近更新 更多