简体   繁体   English

从 imagePicker 中选择图像时,iOS11.2.6、Xcode 9.2 应用程序崩溃

[英]While selecting image from imagePicker, app gets crashes for iOS11.2.6, Xcode 9.2

I have one imageView and I want to select image from Camera/Gallery to keep selected image on imageView.我有一个 imageView,我想从相机/图库中选择图像以将所选图像保留在 imageView 上。 But, on selection of Gallery, my app gets crashing in iOS 11.2.6 with given error:但是,在选择图库时,我的应用程序在 iOS 11.2.6 中崩溃并出现给定错误:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Only RGBA or White color spaces are supported in this situation.'由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“在这种情况下仅支持 RGBA 或白色颜色空间。”

But, it is working fine for iOS version less than 11. I have added all the required things in info.plist.但是,它适用于低于 11 的 iOS 版本。我在 info.plist 中添加了所有必需的东西。 Still it is not working for iOS 11.它仍然不适用于 iOS 11。

Please help me out in this.请帮我解决这个问题。

Updated: My Code更新:我的代码

UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:nil message:@"Choose From" preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {

        // Cancel button tappped.
        [self dismissViewControllerAnimated:YES completion:^{
        }];
    }]];

    [actionSheet addAction:[UIAlertAction actionWithTitle:@"Gallery" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
        UIImagePickerController *imgpicker = [[UIImagePickerController alloc] init];
        imgpicker.allowsEditing = YES;
        imgpicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
        imgpicker.delegate=(id)self;
        [self presentViewController:imgpicker animated:YES completion:nil];
    }]];

[self presentViewController:actionSheet animated:YES completion:nil];

I am using the same code for another project, so it working for another project.我在另一个项目中使用相同的代码,因此它适用于另一个项目。 But for this project it is crashing.但是对于这个项目,它正在崩溃。

This is just because of UITabbar remove background image for Tabbar.这只是因为 UITabbar 删除了 Tabbar 的背景图像。

It works fine for me.这对我来说可以。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM