简体   繁体   中英

Crash at the AppDelegate (top_level_code) when button is pressed in a popup

I have found this example app , which works great. Now I copied the files PopUpViewController_iPad.xib and PopUpViewControllerSwift.swift to my project to use it. But on my project is crashes when I tap the 'close' button. The green exception line shows me the AppDelegate class declaration line (the error is EXC_BAD_ACCESS). The command line area shows me only the lldb command and no error message. I know I can query the lldb for information, but I don't know how to work with lldb .

The error:

在此处输入图片说明

The stack trace:

在此处输入图片说明

Since I run it for iPad air, I put in my projects main view controller the following three lines (which I copied from the example app)

popViewController = PopUpViewControllerSwift(nibName: "PopUpViewController_iPad", bundle: nil)
popViewController.title = "This is a popup view"
popViewController.showInView(self.view, withImage: UIImage(named: "typpzDemo"), withMessage: "You just triggered a great popup window", animated: true)

I thought it may be simply sending the touchUpInside message the the parent view which showed this popup, so I just implemented there another closePopup method with a simple println("1") , but nothing changed.

I also tried adding to PopUpViewControllerSwift.swift the line self.closeButton.becomeFirstResponder() inside the viewDidAppear method (of course with a defined outlet). But the bug remained the same.

I have checked that the identity inspector of "File's owner" and the Class is set correctly to PopUpViewControllerSwift, the module is None (just like in the example). I checked all outlets and stuff, but could not find any difference.

Anyone knows whats up?

Although it seems like you already checked outlets, to help future readers with a similar problem, if using Storyboard, this often occurs because an outlet is missing. Be sure to check all view controllers, not just the initial view controller, for missing outlets.

I had a slightly different error but still the same symptom - reason? I had forgotten to include some used fonts to the new target :-/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM