小编oni*_*ion的帖子

UIImagePickerController,检查相机

-(void)viewDidLoad
{
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
   {
      imagePicker = [[UIImagePickerController alloc] init];
      imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
      imagePicker.showsCameraControls = NO;
      [self.view addSubview:imagePicker.view];
      }
      else
      {
      // UIAlertView…
      }
}

    -(void)viewDidAppear:(BOOL)animated
    {
        [super viewDidAppear:animated];
        imagePicker.delegate = self;
        [self presentViewController:imagePicker animated:NO completion:NO];
    }
Run Code Online (Sandbox Code Playgroud)

我想在你没有相机的时候发出警报.iPhone应用程序启动并移动此代码.但是,崩溃(此错误>

return UIApplicationMain(argc, argv, nil, NSStringFromClass([CameraAppDelegate class])); > Thread 1: signal SIGABRT) 在模拟器中运行时.

为什么是这样?

iphone xcode uiimagepickercontroller ios

5
推荐指数
1
解决办法
6978
查看次数

标签 统计

ios ×1

iphone ×1

uiimagepickercontroller ×1

xcode ×1