- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我有一个现有的 iPhone 应用程序,我正在向其添加 UISplitViewController
。 iPad 部分工作得很好,但我肯定会在 iPhone 6(S) Plus 上崩溃。
设置 - Master 是一个 UITabBarController
。初始细节是带有占位符 Logo View 的 View 。选择对象后,详细信息将替换为 UITabBarController
。
每当我选择一个项目并在 iPhone 6 Plus 中打开 Detail 并将其从纵向(仅细节可见)旋转到横向(主图可见)时,它就会崩溃。使用占位符详细信息 View 旋转时不会发生这种情况。
在崩溃之前,它确实调用了委托(delegate)方法 primaryViewControllerForExpandingSplitViewController
和 splitViewController(splitViewController: UISplitViewController, separateSecondaryViewControllerFromPrimaryViewController
。但是,在 iPad 上一切正常。
我已经进行了大量搜索,但只看到几个 Twitter 提到了这种类型的崩溃。设置或不设置 displayModeButtonItem
之类的事情没有帮助。
我在一个新项目中重新创建了这个崩溃 - 它可以在这里下载: https://github.com/sschale/SplitViewCrash/
崩溃日志:
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00007fff53609ff8
Exception Note: EXC_CORPSE_NOTIFY
VM Regions Near 0x7fff53609ff8:
MALLOC_TINY 00007f8405000000-00007f8405300000 [ 3072K] rw-/rwx SM=PRV
--> STACK GUARD 00007fff4fe0a000-00007fff5360a000 [ 56.0M] ---/rwx SM=NUL stack guard for thread 0
Stack 00007fff5360a000-00007fff53dff000 [ 8148K] rw-/rwx SM=COW thread 0
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 liboainject.dylib 0x000000010e5e59b2
0 liboainject.dylib 0x000000010e5e59b2
_writeEventToSharedMemory + 27
1 liboainject.dylib 0x000000010e5e55d7 _OARecordFinalEvent + 1161
2 liboainject.dylib 0x000000010e5e79f1 ___swapMethods_block_invoke_6 + 338
3 libobjc.A.dylib 0x000000010f4f9b6b weak_read_no_lock + 89
4 libobjc.A.dylib 0x000000010f4fa4c6 objc_loadWeakRetained + 104
5 com.apple.UIKit 0x00000001110510b6 -[UIViewController presentedViewController] + 58
6 com.apple.UIKit 0x0000000111033fc6 -[UIViewController _canBecomeDeepestUnambiguousResponder] + 31
7 com.apple.UIKit 0x0000000111033fde -[UIViewController _canBecomeDeepestUnambiguousResponder] + 55
8 com.apple.UIKit 0x0000000111033fde -[UIViewController _canBecomeDeepestUnambiguousResponder] + 55
9 com.apple.UIKit 0x0000000111033fde -[UIViewController _canBecomeDeepestUnambiguousResponder] + 55
10 com.apple.UIKit 0x0000000111033fde -[UIViewController _canBecomeDeepestUnambiguousResponder] + 55
//(500 more of those)
....
Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x0000000116e49ee2 kevent64 + 10
1 libdispatch.dylib 0x0000000116ac57f0 _dispatch_mgr_invoke + 260
2 libdispatch.dylib 0x0000000116ac558a _dispatch_mgr_thread + 54
Thread 2:
0 libsystem_kernel.dylib 0x0000000116e495e2 __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x0000000116e0d578 _pthread_wqthread + 1283
2 libsystem_pthread.dylib 0x0000000116e0b341 start_wqthread + 13
Thread 3:
0 libsystem_kernel.dylib 0x0000000116e495e2 __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x0000000116e0d578 _pthread_wqthread + 1283
2 libsystem_pthread.dylib 0x0000000116e0b341 start_wqthread + 13
Thread 4:
0 libsystem_kernel.dylib 0x0000000116e495e2 __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x0000000116e0d578 _pthread_wqthread + 1283
2 libsystem_pthread.dylib 0x0000000116e0b341 start_wqthread + 13
Thread 5:
0 libsystem_kernel.dylib 0x0000000116e495e2 __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x0000000116e0d578 _pthread_wqthread + 1283
2 libsystem_pthread.dylib 0x0000000116e0b341 start_wqthread + 13
最佳答案
这在 iPad 上也会崩溃。使用多任务处理将应用程序调整为紧凑宽度(例如 1/3 屏幕),按“启动详细信息”按钮,然后将其调整为常规宽度。
当您处于紧凑宽度时, Split View Controller 会“折叠”。这意味着它不再同时显示单独的主视图 Controller 和辅助 View Controller ——相反,它将它们“折叠”到一个 View Controller 层次结构中。当它处于那种环境中时,它通常需要您的帮助才能做出明智的行为。当您的主视图 Controller 和辅助 View Controller 都是 UINavigationController 时,默认行为运行良好,但在其他情况下则不然。
(在您的应用中,主要是 UITabBarController,在您“启动详细信息”一次后,次要也是 UITabBarController。您可能需要重新考虑该设计,因为它使事情变得更加困难。继续阅读。)
您的应用程序的“启动详细信息”按钮执行“显示详细信息”转场,这有效地调用了 UISplitViewController 上的此方法:
public func showDetailViewController(vc: UIViewController, sender: AnyObject?)
注意标题中的注释:
// In a horizontally-compact environment the master view controller
// or detail view controller is sent the showViewController:sender:
// message. If neither one of them provide an implementation for this
// method then it will fall back to a full screen presentation.
“主视图 Controller 或详细 View Controller ”是指当前显示的 View Controller ,在您的例子中是 UITabBarController。但是 UITabBarController 没有为 showViewController()
实现任何东西,因为它没有足够的信息——它将在哪里显示 View Controller ?它会添加一个新标签,还是替换旧标签,还是什么?
因此,您将获得备用的全屏演示。我怀疑您是否真的想要那种用户体验。
稍后,当大小变回常规并且 Split View Controller 展开时,它会被演示弄糊涂并最终崩溃。 (明白我的意思是默认值不是很好吗?)
解决此问题的一种方法是实现委托(delegate)方法来处理 showDetail
。当宽度为 Compact 时,明确找到要将新 View Controller 放在其上的 View Controller ,然后执行此操作。我认为您可能想在第一个选项卡中推送到导航 Controller :
func splitViewController(splitViewController: UISplitViewController, showDetailViewController vc: UIViewController, sender: AnyObject?) -> Bool
{
if splitViewController.traitCollection.horizontalSizeClass == .Compact {
// The default implementation will not handle this properly.
// Find the appropriate navigation controller and push onto it.
// It would be better to have a direct outlet to the appropriate navigation controller,
// but this will work for an example...
if let tabBarController = splitViewController.viewControllers.first as? UITabBarController {
if let navController = tabBarController.viewControllers?.first as? UINavigationController {
navController.pushViewController(vc, animated: true)
// we handled the "show detail", so split view controller,
// please don't do anything else
return true
}
}
}
// we did not handle the "show detail", so split view controller,
// please do your default behavior
return false
}
如果这样做,您还需要实现此委托(delegate)方法。当大小变回常规时,您将希望通过从同一导航 Controller 弹出该 View Controller 然后返回它来处理“扩展”:
optional public func splitViewController(
splitViewController: UISplitViewController
separateSecondaryViewControllerFromPrimaryViewController
primaryViewController: UIViewController) -> UIViewController?
关于ios - iPhone 6 Plus UISplitViewController 崩溃与递归 _canBecomeDeepestUnambiguousResponder,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37578425/
我知道 UISplitViewController 只能用作根 Controller 。但是否可以从一个分割 View 转到另一个分割 View ? 喜欢加载具有不同数据和布局的详细 View 和主视
然后将其合并到垂直 View 中?这是来自 IMDB 应用程序的示例。 http://img39.imageshack.us/img39/5636/imdb2.jpg http://img39.ima
iOS 5.1 中与 UISplitViewController 相关的新行为应用程序似乎正在拦截 UISlider产生不良结果的运动。这可能也适用于 UISegmented控件和任何其他处理从左到右
我有一个 UISplitViewController,并尝试从 MasterViewController 获取事件并完全更改 DetailViewController。据我了解,这基本上可以通过执行以
每当用户在iPad的UIsplitView中从横向 View 切换到纵向 View 时,我都希望使弹出窗口 View 可见。虽然用户可以通过单击条形按钮使其可见,但我希望此操作对于纵向模式是自动的。
我最近遇到了一个问题。我的iPad应用程序某种程度上阻止了iPad自动旋转。我的应用程序加载了一个UISplitView,这两个 View Controller 都为shouldAutorotateT
我正在开发一个 iPadOS 应用程序,我在其中使用了 UISplitViewController。到目前为止,我一直在使用旧的 API 并手动处理所有内容(包括 displayModeButtonI
我正在尝试将 splitview Controller 添加为 subview Controller 。父 View Controller 是导航 Controller 。父 View Control
我在我的应用程序中使用 MGSplitViewController 库。直到 iOS7 都可以正常工作,但是对于 iOS8 来说,它不能按预期工作,原因是iOS8中 UIPopoverControll
我有一个根 UISplitViewController,其中包含与 DetailViewController 相关的 UINavigationController。 DetailViewControl
我在让 UISplitViewController 在通用应用程序中工作时遇到问题,我已经对 iPhone 部分进行了编码。作为一种故障排除方法,我决定从一个新项目开始,并尝试执行导致问题的一个操作,
我想在纵向模式下创建一个 UISplitViewController,就像在“设置”应用程序中一样。我该怎么做? 最佳答案 有点晚了,还看一下MGSplitViewController作者:马特·格梅
如何在横向模式下隐藏splitviewcontroller的detailView中的导航Bar? 在详细 View 中,我尝试过这样 self.navigationController.navigat
在我的 iPad 应用程序中,我使用带有两个 UINavigationControllers 作为主控和细节的 UISplitViewController。在 Potrait 中,我希望通过 UIPo
在我的 iPad 应用程序中。我正在处理 UISplitViewController .在 DetailViewController的 UISplitViewController有按钮。当按下该按钮时
我想知道是否可以使用带有按钮的普通 ViewController,当您单击按钮时,它会显示一个新的 Controller ,该 Controller 分为两个带有 uisplitviewcontrol
我设置了一个非常简单的 iOS splitView Controller 项目,它有一个非常奇怪的错误。如果您以横向模式启动应用程序,请单击一个按钮以打开另一个 View ,旋转到纵向,然后返回到起始
抱歉,如果之前已经发布过此内容,我浏览了 Apple Docs 等,但找不到有关 UISplitViewController 工作原理的良好解释。 我问这个问题是因为我为 UINavigationBa
我有一个带有 SplitView 的应用程序,可让您将公司添加到数据库中。在 masterView 中,公司显示其各自的公司名称。点击其中一家公司会向我显示“viewCell”中的地址(实际上不是单元
我们正在使用 UISplitViewController。当不处于“分割模式”时显示详细 View Controller 时,屏幕顶部会出现一个灰色条。有谁知道为什么会发生这种情况。在分割 View
我是一名优秀的程序员,十分优秀!