2013-02-22 74 views
0

,當我問到顯示imagePicker與天地我的相簿的照片我得到崩潰:PLUIPrivacyViewController和獲取照片庫

*** 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中允許/拒絕),它會崩潰,但如果我已經授予允許(允許)它將工作正常。 我怎麼解決它?

回答

0

我找到了我的問題的解決方案。 的代碼是不是我的,這是外包人項目的奇怪relisation ..反正他們要求每個視圖控制器XIB文件類別的UIViewController

- (NSString *)nibName { 
    if (! [NSStringFromClass([self class]) isEqualToAnyString:[NSArray arrayWithObjects: 
                   @"UIStatusBarViewController", 
                   @"UIZoomViewController", 
                   @"PLUIPrivacyViewController", 
                   nil]]) { 
     return NSStringFromClass([self class]); 
    } 
    return nil; 
} 

和ios6.0蘋果加入PLUIPrivacyViewController whitch不要有自己的筆尖..我只是添加PLUIPrivacyViewController在例外.. Ofcource更好的方式,使控制器白名單6 cuz項目是真的老了,不會修改,但蘋果可以添加一些其他控制器沒有筆尖... 但它很多時間。