Ios 如何使用iPad访问我的照片库和摄像机

Ios 如何使用iPad访问我的照片库和摄像机,ios,ipad,video,photo-gallery,video-gallery,Ios,Ipad,Video,Photo Gallery,Video Gallery,仅在iOS 8.3中,我很难访问iPad上的照片和摄像机。我对iPhone代码没有问题。而且,这段代码适用于iOS 7中的两种设备。现在还不清楚为什么会这样。当弹出发生时,我选择“选择现有的照片或视频”,其他什么都不会发生。我确实设置了允许访问照片/视频库的应用权限。这是我的代码示例。有人有类似的问题吗 - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex

仅在iOS 8.3中,我很难访问iPad上的照片和摄像机。我对iPhone代码没有问题。而且,这段代码适用于iOS 7中的两种设备。现在还不清楚为什么会这样。当弹出发生时,我选择“选择现有的照片或视频”,其他什么都不会发生。我确实设置了允许访问照片/视频库的应用权限。这是我的代码示例。有人有类似的问题吗

    - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
        if (buttonIndex != 2) {
            imagePickerController = [[UIImagePickerController alloc] init];
            imagePickerController.allowsEditing = NO;
            imagePickerController.delegate = self;

            if (buttonIndex == 0) {
                imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;

                [self presentViewController:imagePickerController animated:YES completion:nil];
            } else {

                imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

                if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
                    popover = [[UIPopoverController alloc] initWithContentViewController:imagePickerController];

                    [popover presentPopoverFromRect:CGRectMake(54.0f, 120.0f, 660.0f, 380.0f) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];

                } else {
                    [self presentViewController:imagePickerController animated:YES completion:nil];
                }
            }
        }
    }

您必须检查您的viewcontroller是否为nil。

检查popover或viewcontroller是否为nil我收到以下警告:尝试在已呈现的视图上呈现(null)两个视图都显示为niliOS 8不使用UIPopopOvercontroller。你需要为iOS 8重新编写和更新。哦,好的……哇。我会调查的。谢谢