DriverWorkDiary[2564:60b] * Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES' * First throw call stack: (0x2ff30fd3 0x3aaf8ccf 0x2ff30f15 0x327be4fb 0x327c5b05 0x327c5ab9 0x327c4bf9 0x3274c729 0x3274c507 0x3274be71 0x3274bcc5 0x32758a6f 0x327584df 0x32803ccf 0x32803aeb 0x327fb995 0x327fae1d 0x327fab8d 0x327fab25 0x3274cd79 0x323ca62b 0x323c5e3b 0x323c5ccd 0x323c56df 0x323c54ef 0x323bf21d 0x2fefc2a5 0x2fef9c49 0x2fef9f8b 0x2fe64f4f 0x2fe64d33 0x34d8a663 0x327b016d 0xf7ca5 0x3b005ab7) libc++abi.dylib: terminating with uncaught exception of type NSException
This is my code:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
UIImagePickerController *picker;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {
picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:picker animated:YES completion:NULL];
}
} else {
UIImagePickerController *picker;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {
picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:picker animated:YES completion:NULL];
}
}