我在更新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"
错误。