使用单点触控从 iPhone 相册中选择时崩溃
我的应用程序完全崩溃(致命错误),显示整个堆栈跟踪和“连接 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也遇到了同样的问题;事实证明 ImagePickerController 对象正在被垃圾收集,您是否在方法内部声明了该属性(例如按钮触摸事件?)。我发现如果我在课程开始时声明该属性,那么它就解决了这个问题。代码示例:
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:
The ImagePickerDelegate Class is pretty simple, I've only overridden the
FinishedPickingMedia
method.