XCode 9.0:错误域= PlugInKit代码= 13"查询已取消"允许权限后出错

时间:2017-11-02 01:54:06

标签: ios objective-c uiimagepickercontroller info.plist

我在更新Xcode后在模拟器上运行我的应用程序时遇到此错误。我查看了与此错误相关的其他SO问题,它们都与权限有关。但是,即使在包含要求权限的代码并确保Photo Library Usage位于我的Info.plist之后,我仍然会收到错误。

- (void)viewDidAppear:(BOOL)animated
{


    [super viewDidAppear:animated];

    [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
        switch (status) {
            case PHAuthorizationStatusAuthorized:
                NSLog(@"PHAuthorizationStatusAuthorized");
                ipc = [[UIImagePickerController alloc] init];
                ipc.delegate = self;
                if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
                {
                    ipc.sourceType = UIImagePickerControllerSourceTypeCamera;
                    ipc.showsCameraControls = NO;
                    ipc.tabBarController.tabBar.hidden = YES;
                    ipc.allowsEditing = NO;

                    [self addChildViewController:ipc];
                    [self.view addSubview:ipc.view];
                    [ipc didMoveToParentViewController:self];

                }else{
                    ipc.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
                    //launch image picker view controller
                    ipc.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
                    [self presentViewController:ipc animated:YES completion:nil];

                }
                break;
            case PHAuthorizationStatusDenied:
                NSLog(@"PHAuthorizationStatusDenied");
                break;
            case PHAuthorizationStatusNotDetermined:
                NSLog(@"PHAuthorizationStatusNotDetermined");
                break;
            case PHAuthorizationStatusRestricted:
                NSLog(@"PHAuthorizationStatusRestricted");
                break;
        }
    }];
}

当我点击此视图的选项卡时,我只是让LibraryControlSource的IPC视图控制器向上滑动屏幕然后向下(就像被解雇一样)不间断。每次滑动时,我都会在控制台中收到Error Domain=PlugInKit Code=13 "query cancelled"错误。

0 个答案:

没有答案