ios – 呈现UIImagePickerController会崩溃应用程序

ios – 呈现UIImagePickerController会崩溃应用程序,第1张

概述我试图通过Button动作呈现UI ImagePickerController.我的项目因错误而崩溃: Got a SIGABRT while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your appl 我试图通过button动作呈现UI ImagePickerController.我的项目因错误而崩溃:

Got a SIGABRT while executing native code. This usually indicates
a Fatal error in the mono runtime or one of the native librarIEs
used by your application.

我只在Storyboard中的NavigationController中嵌入了一个VIEwController.代码片段如下:

UIImagePickerController imagePicker;public overrIDe voID VIEwDIDLoad(){    base.VIEwDIDLoad();    this.setupImagePicker();    CapturePhotobutton.touchUpInsIDe += delegate    {        this.AddMedia();    };}public voID setupImagePicker(){    imagePicker = new UIImagePickerController();    imagePicker.sourceType = UIImagePickerControllerSourceType.Camera;    imagePicker.ModalPresentationStyle = UIModalPresentationStyle.Popover;    imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes(        UIImagePickerControllerSourceType.Camera);    imagePicker.FinishedPickingMedia += HandleFinishedPickingMedia;    imagePicker.Canceled += (sender,e) => {        imagePicker.dismissModalVIEwController(true);    };}public voID HandleFinishedPickingMedia(object sender,UIImagePickerMediAPIckedEventArgs e){    bool isImage = false;    switch (e.Info[UIImagePickerController.MediaType].ToString())    {        case "public.image":            isImage = true;            break;        case "public.vIDeo":            break;    }    if (isImage)    {        UIImage originalimage = e.Info[UIImagePickerController.Originalimage] as UIImage;        if (originalimage != null)        {            PrevIEwImageVIEw.Image = originalimage;            imagePicker.dismissVIEwController(true,null);        }    }}public voID AddMedia(){    //Crashes on this line    this.NavigationController.PresentVIEwController(imagePicker,true,null);}
解决方法 为您的info.pList添加了隐私 – 相机使用说明,解决了问题 总结

以上是内存溢出为你收集整理的ios – 呈现UIImagePickerController会崩溃应用程序全部内容,希望文章能够帮你解决ios – 呈现UIImagePickerController会崩溃应用程序所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1070759.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存