相关疑难解决方法(0)

使用UIImagePickerController时iOS 10错误[access] <private>

我正在使用XCode 8并使用iOS 10.2 Beta进行测试.

我已将Photos,PhotosUI和MobileCoreServices框架添加到项目中.

非常简单的代码:

#import <Photos/Photos.h>
#import <PhotosUI/PhotosUI.h>
#import <MobileCoreServices/MobileCoreServices.h>

@interface ViewController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate, PHLivePhotoViewDelegate>

@property (strong, nonatomic) IBOutlet UIImageView *imageview;

@end
Run Code Online (Sandbox Code Playgroud)

和实施:

- (IBAction)grab:(UIButton *)sender{
    UIImagePickerController *picker = [[UIImagePickerController alloc]init];
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    picker.allowsEditing = NO;
    picker.delegate = self;

    // make sure we include Live Photos (otherwise we'll only get UIImages)
    NSArray *mediaTypes = @[(NSString *)kUTTypeImage, (NSString *)kUTTypeLivePhoto];
    picker.mediaTypes = mediaTypes;

    // bring up the picker
    [self presentViewController:picker animated:YES completion:nil];
}
Run Code Online (Sandbox Code Playgroud)

一旦我点击按钮,应用程序崩溃时出现非常无用的错误:

[access] <private>

而已.没有其他的. …

objective-c uiimagepickercontroller ios presentviewcontroller ios10

102
推荐指数
5
解决办法
6万
查看次数