此代码在 iOS6.2 下工作;安装了iOS7,现在崩溃了:
- (IBAction)bOpenCamera:(UIButton *)sender {
if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) {
customerCameraFlag = YES; // indicator so text fields are not cleared
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = (id)self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.mediaTypes = [NSArray arrayWithObjects: (NSString *) kUTTypeImage, nil];
imagePicker.allowsEditing = NO;
[self presentViewController:imagePicker animated:YES completion:nil];
newMedia = YES;
}
}
我在两个单独的类中使用相同的代码;没有一个工作。相机永远不会打开,只是在执行最后一行(newMedia = YES)时崩溃。我查看了 SO 和 Google 中的所有条目,并没有发现任何类似于这次崩溃的内容。它显然适用于 iOS 6,但我现在无法测试它,因为我已经转到 iOS7。
有想法该怎么解决这个吗?