0

UPDATE 2019/07/23 16:37:00 - I've updated the main storyboard script below in the original content. After trying several things and running into new errors that had to be corrected I have come full circle back to the same error message. Updated script and stack trace below. This time the stracktrace is referencing a 'null value' most likely referring to the following line of code but removing it does not remove the error unless that's a simulator's cache issue:

 guard (URL(string: "http://southeastgeorgiatoday.com") != nil) else {
    return
}

UPDATE 2019/07/22 20:01:00 - I have made some progress working with the referencing outlets and I finally have the app loading but now instead of crashing during the load, it crashes during the click event when an UIButton is clicked to load a UIViewController which which is a WKWebView. So now instead of crashing at the app load, it crashes on the click and loading of the webview. I have updated the script and the stack trace info.

Created actions for UIButtons to load wkwebviews via outlets.

Here is my storyboard script showing one of the uibuttons within it, there is a total of six of them but for the purpose of troubleshooting I've only included now of them here. They are all pretty much written in the same fashion making sure to identify the appropriate button and web view where applicable.


import WebKit
import UIKit


class UIViewController_sega: UIViewController, WKNavigationDelegate {

@IBAction func UIButton_sega(_ sender: Any) {
performSegue(withIdentifier: "WKWebView_sega", sender: sender)
}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let UIButton_sega = sender as? UIButton, let destination = segue.destination as? UIViewController_sega {}
}

@IBOutlet var WKWebView_sega: WKWebView!
override func loadView() {}
override func viewDidLoad() {
  super.viewDidLoad()
    guard (URL(string: "http://southeastgeorgiatoday.com") != nil) else {
    return
}
}

func WKWebView_sega(_ webView: WKWebView, didCommit navigation: WKNavigation!) {}

}

Here is my AppDelegate.swift file:

import UIKit
import CoreData

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        return true
    }

    func applicationWillTerminate(_ application: UIApplication) {
        self.saveContext()
    }

    lazy var persistentContainer: NSPersistentContainer = {
        let container = NSPersistentContainer(name: "SoutheastGeorgiaToday")
        container.loadPersistentStores(completionHandler: { (storeDescription, error) in
            if let error = error as NSError? {
                fatalError("Unresolved error \(error), \(error.userInfo)")
            }
        })
        return container
    }()

    func saveContext () {
        let context = persistentContainer.viewContext
        if context.hasChanges {
            do {
                try context.save()
            } catch {
                let nserror = error as NSError
                fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
            }
        }  
    }

}

I get the "Thread 1: signal SIGABRT" at this line in the AppDelegate.swift file: (this still remains the case only it happens during the WKWebView load after the UIButton click; where as previously it was during the app load and this time stack trace is referencing the class of the WKWebView 'WKWebView_s'; not the UIButton class 'button_sega' )

class AppDelegate: UIResponder, UIApplicationDelegate {

Here is my stacktrace

2019-07-23 16:37:01.980409-0400 SoutheastGeorgiaToday[1598:33823] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not create a segue of class '(null)''
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010ebe71bb __exceptionPreprocess + 331
    1   libobjc.A.dylib                     0x000000010c01c735 objc_exception_throw + 48
    2   CoreFoundation                      0x000000010ebe6f42 +[NSException raise:format:arguments:] + 98
    3   Foundation                          0x000000010ba1f877 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
    4   UIKitCore                           0x000000011777555d -[UIStoryboardSegueTemplate segueWithDestinationViewController:] + 216
    5   UIKitCore                           0x0000000117775731 -[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 74
    6   UIKitCore                           0x00000001177756b9 -[UIStoryboardSegueTemplate _perform:] + 82
    7   UIKitCore                           0x000000011777597b -[UIStoryboardSegueTemplate perform:] + 157
    8   UIKitCore                           0x00000001175d4ecb -[UIApplication sendAction:to:from:forEvent:] + 83
    9   UIKitCore                           0x00000001170100bd -[UIControl sendAction:to:forEvent:] + 67
    10  UIKitCore                           0x00000001170103da -[UIControl _sendActionsForEvents:withEvent:] + 450
    11  UIKitCore                           0x000000011700f31e -[UIControl touchesEnded:withEvent:] + 583
    12  UIKitCore                           0x00000001171a8018 _UIGestureEnvironmentSortAndSendDelayedTouches + 5387
    13  UIKitCore                           0x00000001171a1fd1 _UIGestureEnvironmentUpdate + 1506
    14  UIKitCore                           0x00000001171a19ad -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 478
    15  UIKitCore                           0x00000001171a171d -[UIGestureEnvironment _updateForEvent:window:] + 200
    16  UIKitCore                           0x000000011761178a -[UIWindow sendEvent:] + 4058
    17  UIKitCore                           0x00000001175ef394 -[UIApplication sendEvent:] + 352
    18  UIKitCore                           0x00000001176c45a9 __dispatchPreprocessedEventFromEventQueue + 3054
    19  UIKitCore                           0x00000001176c71cb __handleEventQueueInternal + 5948
    20  CoreFoundation                      0x000000010eb4c721 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    21  CoreFoundation                      0x000000010eb4bf93 __CFRunLoopDoSources0 + 243
    22  CoreFoundation                      0x000000010eb4663f __CFRunLoopRun + 1263
    23  CoreFoundation                      0x000000010eb45e11 CFRunLoopRunSpecific + 625
    24  GraphicsServices                    0x0000000112e9f1dd GSEventRunModal + 62
    25  UIKitCore                           0x00000001175d381d UIApplicationMain + 140
    26  SoutheastGeorgiaToday               0x000000010afca1c7 main + 71
    27  libdyld.dylib                       0x000000010f94b575 start + 1
    28  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

I have researched all references but they are all different and none of them mirror my exact situation and scenario. Like I said, I have tried the other articles and I see how they are similar, but it did not fix it so something is different; I just don't know what. When I do what it say I get other error messages that remove items changed and leave other items. What remains in my storyboard now removed all errors caused by the fix in the article individuals keep rerunning but then it still doesn't solve the thread 1 signal issue.

4

0 回答 0