我正在使用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
和实现:
- (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"处应用程序似乎会崩溃。
这是一个全新的应用程序,除了抓取按钮之外,界面上没有其他内容。
此外,在iOS 9.3上进行测试,一切正常。我是否错过了某些在iOS 10中可能更改的东西?