簡體   English   中英

iPhone 應用程序在使用 SIGABRT 的 AppDelegate 中啟動時崩潰

[英]iPhone application crashes on start up in AppDelegate with SIGABRT

我的應用程序實際上是在 20 分鍾前啟動的,但現在我什至無法讓它在不崩潰的情況下加載登錄屏幕。 它在 AppDelegate 上崩潰,控制台中唯一的錯誤是

terminating with uncaught exception of type NSException

在控制台中使用 bt 命令提供以下堆棧跟蹤

* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x000000010bcea2c6 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x000000010bd3dbf1 libsystem_pthread.dylib`pthread_kill + 284
    frame #2: 0x000000010ba76a3c libsystem_c.dylib`abort + 120
    frame #3: 0x000000010acc37f8 libc++abi.dylib`abort_message + 231
    frame #4: 0x000000010acc39c7 libc++abi.dylib`demangling_terminate_handler() + 262
    frame #5: 0x0000000109e0dd7c libobjc.A.dylib`_objc_terminate() + 96
    frame #6: 0x000000010acd0e97 libc++abi.dylib`std::__terminate(void (*)()) + 8
    frame #7: 0x000000010acd0ae9 libc++abi.dylib`__cxa_rethrow + 99
    frame #8: 0x0000000109e0dcb4 libobjc.A.dylib`objc_exception_rethrow + 37
    frame #9: 0x0000000109ef1eea CoreFoundation`CFRunLoopRunSpecific + 570
    frame #10: 0x000000010e7e2bb0 GraphicsServices`GSEventRunModal + 65
    frame #11: 0x0000000117007dd0 UIKitCore`UIApplicationMain + 1621
  * frame #12: 0x0000000103f9812b TheBiggestBlunt`main at AppDelegate.swift:14:7
    frame #13: 0x000000010b94fd29 libdyld.dylib`start + 1

當我在 AppDelegate 類中放置斷點時,如下所示:


import UIKit
import Firebase
import SwiftKeychainWrapper

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?
    //var actIdc = UIActivityIndicatorView(style: .whiteLarge)
    //lazy var rect = CGRect(x: 10, y: 10, width: 100, height: 100)
    //var container = UIView(frame:rect)

    //var container: UIView = UIView()

    class func instance() -> AppDelegate {
        return UIApplication.shared.delegate as! AppDelegate
    }

//    func showActivityIndicator(){
//        if let window = window{
//            let rect = CGRect(x: 10, y: 10, width: 100, height: 100)
//            container = UIView(frame: rect)
//            //container = UIView()
//            container.frame = window.frame
//            container.center = window.center
//            container.backgroundColor = UIColor(white: 0, alpha: 0.8)
//            actIdc.frame = CGRect(x:0, y:0, width:40, height:40)
//            actIdc.center = CGPoint(x:container.frame.size.width/2,y:container.frame.size.height/2)
//            container.addSubview(actIdc)
//            window.addSubview(container)
//            actIdc.startAnimating()
//        }
//    }

//    func dismissActivityIndicator(){
//        if let _ = window{
//            container.removeFromSuperview()
//        }
//    }

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        FirebaseApp.configure()
        return true
    }

    func applicationWillResignActive(_ application: UIApplication) {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
    }

    func applicationDidEnterBackground(_ application: UIApplication) {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }

    func applicationWillEnterForeground(_ application: UIApplication) {
        // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
    }

    func applicationDidBecomeActive(_ application: UIApplication) {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }

    func applicationWillTerminate(_ application: UIApplication) {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }


}

它轉到第一個未注釋的行,然后轉到匯編代碼,然后運行。 您會看到登錄頁面 1 秒鍾,然后應用程序會給出一個 SIGABRT。

我已經檢查了所有 IBOutlets,沒有任何問題。

有人有這方面的經驗嗎?

您可能缺少需要添加到項目中的GoogleService-Info.plist文件

在此處輸入圖片說明

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM