0

xcode と Objective-C の初心者。私の新人の間違いを許してください。アプリをクリーン/ビルドしてもエラーはありませんが、ボタンをクリックして「UIIMagePickerController」をロードすると、アプリが終了してエラーがスローされます。助けてください。どうも

- (void)showImagePickerForSourceType:(UIImagePickerControllerSourceType)sourceType
{
    if (self.imageView.isAnimating)
    {
        [self.imageView stopAnimating];
    }

    if (self.capturedImages.count > 0)
    {
        [self.capturedImages removeAllObjects];
    }

    UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
    imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
    imagePickerController.sourceType = sourceType;
    imagePickerController.delegate = self;

    if (sourceType == UIImagePickerControllerSourceTypeCamera)
    {
        imagePickerController.showsCameraControls = NO;

        [[NSBundle mainBundle] loadNibNamed:@"OverlayView" owner:self options:nil];
        self.overlayView.frame = imagePickerController.cameraOverlayView.frame;
        imagePickerController.cameraOverlayView = self.overlayView;
        self.overlayView = nil;
    }

    self.imagePickerController = imagePickerController;
   [self presentViewController:self.imagePickerController animated:YES completion:nil];

}

4

3 に答える 3