【发布时间】:2016-09-16 15:17:12
【问题描述】:
奇怪的问题:
我的用户通过点击按钮来拍照来激活 iPhone 相机。例如。按钮被点击,相机打开。直到昨天,下面的代码都可以正常工作(在我自己的手机上仍然可以)。但是,在我们测试组中其他所有人的手机上,只要点击相机按钮,应用就会崩溃。知道为什么吗?请参阅下面的代码 - 我很难过。 注意:每个人都在运行 iOS 10。
ViewController.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController <UITextFieldDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate> {
}
@property (strong, nonatomic) NSMutableArray *photoData;
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@end
ViewController.m
- (IBAction)takePhoto:(id)sender {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:picker animated:YES completion:NULL];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *chosenImage = info[UIImagePickerControllerEditedImage];
self.imageView.image = chosenImage;
[picker dismissViewControllerAnimated:YES completion:NULL];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
[picker dismissViewControllerAnimated:YES completion:NULL];
}
【问题讨论】:
-
请,当您发布有关崩溃的问题时,您必须包含崩溃中完整且准确的错误消息,并指出导致崩溃的确切代码行。
-
@rmaddy 这次我没有这样做的唯一原因是因为我看不到崩溃错误(很复杂,我知道)。在我的设备上,它运行良好。但是它似乎在其他设备上崩溃(我无法插入自己的计算机)......
-
让用户向您发送崩溃报告。
-
@rmaddy 假设他们不是超级精通技术 - 他们怎么能做到这一点?他们的设置中有什么东西吗?从来没有真正需要它哈哈。
-
设置 -> 隐私 -> 诊断和使用 -> 诊断和使用数据。然后他们需要找到该应用程序的最新条目并查看它。然后煞费苦心地选择所有文本,然后通过电子邮件发送给您。
标签: ios objective-c iphone camera viewcontroller