我正在使用XCode8,并使用iOS 10.2Beta进行测试.
我已经将照片、PhotoUI和MobileCoReserves框架添加到项目中.
非常简单的代码:
#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
和实施:
- (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];
}
我一按按钮,应用程序就会崩溃,并出现非常无用的错误:
[access] <private>
个
就这样.没别的了.
使用break语句,应用程序似乎在"presentViewController"上崩溃.
这是一个全新的应用程序,除了抓取按钮之外,我的UI中没有其他任何东西.
此外,在iOS9.3上进行测试时,该功能运行良好.我是否遗漏了iOS10中可能会更改的内容?