我用两个不同的应用程序尝试了两次,我得到了同样的结果。我设置了一个 UIImagePIckerController 实例,如下所示:
- (IBAction)addImage:(UIBarButtonItem *)sender {
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
NSArray *mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera];
if ([mediaTypes containsObject:(NSString *)kUTTypeImage]) {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeImage];
picker.allowsEditing = NO;
picker.showsCameraControls = NO;
[self presentViewController: picker animated:YES completion:NULL];
}
[..]
}
这是第二个。首先,我设置了一个自定义叠加层来运行快门和其他功能。一切运行良好,但我在控制台上不断收到错误消息:
<Error>: CGAffineTransformInvert: singular matrix.
当我运行应用程序时,每次我在相机启动时旋转(或移动它发出旋转信号)设备{something happens here}
。我在 iPhone 4 和 iPad Mini 上都试过了,结果相同。经过大量挖掘后,我发现这只发生在以下情况下
picker.showsCameraControls = NO;
如果我把
picker.showsCameraControls = YES;
然后我没有收到任何消息(尽管我的自定义覆盖也被隐藏了)。确保它不是自定义叠加层本身,我尝试将其排除在外,但它仍然给出错误消息。
有人知道我应该怎么做吗?