ios - 关闭 View Controller 使应用程序崩溃(lldb)

标签 ios swift

当我使用 lldb 关闭 Controller 时,我的应用程序出现问题,我没有做错任何事情,我将在此处提供项目和示例代码:

我在这里展示它:

func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {

    var cont = storyboard?.instantiateViewControllerWithIdentifier("Detail") as! Detail
    cont.link = indexPath.row
    self.view.window?.rootViewController?.presentViewController(cont, animated: true, completion: nil)

}

并在这里关闭它:

@IBAction func disiss(sender: AnyObject) {

    self.dismissViewControllerAnimated(true, completion: nil)


}

我的项目在这里: https://yadi.sk/d/pSscby7ZicqSU

我认为当尝试快速打开和关闭以及快速打开和关闭时会出现问题!有时我只是打开它并解雇它,它就崩溃了!我正在 iPhone 6 上进行测试。我刚刚在模拟器 iPhone 6 上试过它,但它崩溃了。

最佳答案

在 ViewController.swift 中

替换

 override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
 }

 override func viewDidLoad() {
        super.viewDidLoad()

 }

关于ios - 关闭 View Controller 使应用程序崩溃(lldb),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32176105/

相关文章:

ios - 如何将从 CGImageRef 创建的 UIImage 对象转换为原始数据并再次转换回来

iOS 多行标签在 Xcode 7.3 中不支持多行

json - 错误 : Type 'Any' has no subscript members AlamoFire with Swift 4

swift - 类型 'StorageMetadata' 的值没有成员 'downloadURL'

variables - Swift 中的多变量赋值

ios - 收藏 View 在闪烁后不显示任何项目

objective-c - 从AppDelegate访问其他Class实例

ios - 如何在大型导航栏上使用图像作为标题?

ios - iOS 15 中使用 UIButton.ConfigurationUpdateHandler 的 UIButton 高亮颜色

ios - 自动调整包含 UICollectionView 的 UITableViewCell