UIDocumentMenuViewController在iPad上崩溃,但在iPhone上不崩溃 [英] UIDocumentMenuViewController crashes on iPad but not on iPhone

查看:233
本文介绍了UIDocumentMenuViewController在iPad上崩溃,但在iPhone上不崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

呈现一个UIDocumentMenuViewController以便能够将文件加载到应用程序中.在iPhone上可以使用,但在iPad上不能使用.使用iOS9.知道有什么问题吗?

Presenting a UIDocumentMenuViewController to be able to load file into app. On iPhone it works, but not on iPad. Using iOS9. Any idea what is wrong?

dmvc = UIDocumentMenuViewController(documentTypes: ["public.data"], inMode: .Import)
dmvc!.delegate = self
dmvc!.popoverPresentationController?.sourceView = addSongButton
self.presentViewController(dmvc!, animated: true, completion: nil)

2016-06-07 09:45:45.256记忆[2994:977408]的行为 未定义UICollectionViewFlowLayout的原因是:2016-06-07 09:45:45.260备忘录[2994:977408]商品宽度必须小于 UICollectionView的宽度减去该部分的左插图, right值,减去内容插入的left和right值. 2016-06-07 09:45:45.261记忆[2994:977408]相关 UICollectionViewFlowLayout实例为 < _UIAlertControllerCollectionViewFlowLayout:0x1668e6e0>,它是 附属于; 动画= {bounds.origin =; bounds.size =; position =; };层=; contentOffset:{0,0}; contentSize:{0,0}>集合 视图布局:< _UIAlertControllerCollectionViewFlowLayout:0x1668e6e0>. 2016-06-07 09:45:45.262记忆[2994:977408]做个象征 UICollectionViewFlowLayoutBreakForInvalidSizes处的断点以捕获 在调试器中.

2016-06-07 09:45:45.256 Memorise[2994:977408] the behavior of the UICollectionViewFlowLayout is not defined because: 2016-06-07 09:45:45.260 Memorise[2994:977408] the item width must be less than the width of the UICollectionView minus the section insets left and right values, minus the content insets left and right values. 2016-06-07 09:45:45.261 Memorise[2994:977408] The relevant UICollectionViewFlowLayout instance is <_UIAlertControllerCollectionViewFlowLayout: 0x1668e6e0>, and it is attached to ; animations = { bounds.origin=; bounds.size=; position=; }; layer = ; contentOffset: {0, 0}; contentSize: {0, 0}> collection view layout: <_UIAlertControllerCollectionViewFlowLayout: 0x1668e6e0>. 2016-06-07 09:45:45.262 Memorise[2994:977408] Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.

我不明白为什么错误消息引用了collectionView?我根本不使用collectionView.也许UIDocumentMenuViewController有它作为内部组件吗?

What I do not understand why error message refers collectionView? I do not use collectionView at all. Maybe UIDocumentMenuViewController has it as inner component?

推荐答案

iPad有一些有关ActionSheets及其取消按钮的特殊规则,通常取决于显示ActionSheets的位置,因此这是解决崩溃的方法问题:

iPad has some special rules about ActionSheets and their cancel buttons, It usually depends on where you are displaying the ActionSheets from, so this is how you can resolve the crashing issue:

     let importMenu = UIDocumentMenuViewController(documentTypes: [kUTTypeHTML as String ], in: .import)
    importMenu.delegate = self
    importMenu.modalPresentationStyle = .popover
    importMenu.popoverPresentationController?.sourceView = self.view
    self.present(importMenu, animated: true, completion: nil)

这篇关于UIDocumentMenuViewController在iPad上崩溃,但在iPhone上不崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆