Search code examples
swiftexceptioncrashstoryboardswift4

Application crashing without information about crash when transitioning to another view controller


I have two view controllers, LoginViewController and TermsAndPrivacyViewController.

On first view controller, there is a button that has IBAction, which opens TermsAndPrivacyViewController. On TermsAndPrivacyViewController I have web view, that loads url I am passing from LoginViewController. So, this is the code(Login view controller):

 @IBAction func tosAction(_ sender: Any) {

        if let vc = UIStoryboard(name: "Login", bundle: nil).instantiateViewController(withIdentifier: kTOSViewControllerIdentifier) as? TermsAndPrivacyViewController{

            vc.url =  URL(string: kTOSUrl)
            self.navigationController?.pushViewController(vc, animated: true)

        }
    }

On TermsAndPrivacyViewController, I have this:

override func viewDidLoad() {
        super.viewDidLoad()

        webView.navigationDelegate = self
        if let `url` = url {
            webView.load(URLRequest(url: url))
            webView.allowsBackForwardNavigationGestures = true
        }
    }

So, when I hit a button, app crashes SIGABRT message, and nothing else. Also, I don't get any crash report on Firebase Crashlytics (I have detached an app from a debugger first, and produced a crash).

Now, the strange part :/ ... If I put a breakpoint on a first line of tosAction() method, and go step by step (or just let it continue), everything works normally. No crash???

Am I missing something obvious here? What is the reason of crashing? Also, I tried to put Exception Breakpoint but nothing changes. I only get this:

enter image description here

enter image description here

and a console:

console image

so, kinda no information about crash at all.

EDIT

Ok, now the even more strange part :) I just tried app on different phones.

App crashes on iPhone 6s+, iOS 12.1(16B5059d), but it works normally on iPhone 6, iOS 12.0 (16A366)


Solution

  • maybe you use library or framework that not supported by those device. you must see the error

    did you try this?

    when the app crashing, in the console press cmd+F and search exception. now you can see your error

    hope to helpful.