使用单点触控从 iPhone 相册中选择时崩溃

发布于 2024-11-26 22:36:16 字数 480 浏览 2 评论 0原文

我的应用程序完全崩溃(致命错误),显示整个堆栈跟踪和“连接 stdout 和 stderr 时出错”。但奇怪的是,如果我不关闭 iPhone 模拟器,并且我再次执行应用程序上的工作流程, 当 picker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary 时,一切正常,

我尝试了 PhotoLibrary 和 SavedPhotosAlbum;

直到您打开照片库。单击照片库查看里面的图像,这是当

picker.SourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum 时发生的,相册加载正常,我什至可以选择图像后。图像,我可以编辑图像等......一旦我完成并点击“选择”,它就会

再次崩溃,在它崩溃后,我可以完成工作流程,并且一切都很好

。 ?

谢谢。

My application crashes completely (fatal error), showing the entire stacktrace and "Error connecting stdout and stderr. The weird thing is though, if I do not shut down the iPhone simulator, and I go through the workflow on my app a second time, there is no crash.

I tried both PhotoLibrary and SavedPhotosAlbum;

When picker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary, everything works fine until it brings up the photo library. When you click the photo library to see the images inside, this is when the crash occurs.

When picker.SourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum, the album loads fine, and I can even select an image. After I select an image, I can edit the image, etc...Once I'm done and hit Choose. It crashes.

Again, after it crashes, I can go through the workflow and it gets through just fine.

This is very strange. Any ideas?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

≈。彩虹 2024-12-03 22:36:16

我也遇到了同样的问题;事实证明 ImagePickerController 对象正在被垃圾收集,您是否在方法内部声明了该属性(例如按钮触摸事件?)。我发现如果我在课程开始时声明该属性,那么它就解决了这个问题。代码示例:

UIImagePickerController picker;

//snip

void HandlePhotoBtnTouchUpInside(object sender, EventArgs e)
{
    picker = new UIImagePickerController();
    ImagePickerDelegate imgDel = new ImagePickerDelegate();
    picker.Delegate = imgDel;

    picker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary;
    PresentModalViewController(imagePicker, true);
}

ImagePickerDelegate 类非常简单,我只重写了 FinishedPickingMedia 方法。

I had this exact same problem; it turns out the ImagePickerController object was being garbage collected, are you declaring the property inside of a method (e.g. a button touch event?). I found if I declared the property at the start of the class then it solved this problem. Code sample:

UIImagePickerController picker;

//snip

void HandlePhotoBtnTouchUpInside(object sender, EventArgs e)
{
    picker = new UIImagePickerController();
    ImagePickerDelegate imgDel = new ImagePickerDelegate();
    picker.Delegate = imgDel;

    picker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary;
    PresentModalViewController(imagePicker, true);
}

The ImagePickerDelegate Class is pretty simple, I've only overridden the FinishedPickingMedia method.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文