转换为Swift3之后,ios app崩溃了:线程1:在AppDelegate类中发出SIGABRT信号

时间:2016-06-20 09:40:03

标签: ios swift swift3 ios10

我的原始应用程序在swift2.3中使用xcode 7正常运行,但在我使用xcode 8转换为swift3.0后,出现了很多错误,然后我解决了所有问题。我运行我的swift3应用程序没有错误,但是!它在着陆页中崩溃,并显示错误消息

  

线程1:在AppDelegate类中发出SIGABRT信号

当应用程序在swift2.3中运行时,我对解析和核心数据仍然没有问题。 我还尝试其他解决方案,例如1.add all privacy into info.plist files

<key>NSRemindersUsageDescription</key>
<string>&quot;Do u allow us to use it?&quot;</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>&quot;Do u allow us to use it?&quot;</string>
<key>kTCCServiceMediaLibrary</key>
<string>&quot;Do u allow us to use it?&quot;</string>
<key>NSMotionUsageDescription</key>
<string>&quot;Do u allow us to use it?&quot;</string>
<key>NSMicrophoneUsageDescription</key>
<string>&quot;Do u allow us to use it?&quot;</string>
<key>NSAppleMusicUsageDescription</key>
<string>&quot;Do u allow us to use it?&quot;</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>&quot;Do u allow us to use it?&quot;</string>
<key>NSLocationUsageDescription</key>
<string>&quot;Do u allow us to use it?&quot;</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>&quot;Do u allow us to use it?&quot;</string>
<key>NSHomeKitUsageDescription</key>
<string>&quot;Do u allow us to use it?&quot;</string>
<key>NSHealthUpdateUsageDescription</key>
<string>&quot;Do u allow us to use it?&quot;</string>
<key>NSHealthShareUsageDescription</key>
<string>&quot;Do u allow us to use it?&quot;</string>
<key>NSContactsUsageDescription</key>
<string>&quot;Do u allow us to use it?&quot;</string>
<key>NSCameraUsageDescription</key>
<string>&quot;Do u allow us to use it?&quot;</string>
<key>NSCalendarsUsageDescription</key>
<string>&quot;Do u allow us to use it?&quot;</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>&quot;Do u allow us to use it?&quot;</string>

2.检查我所有关于缺失链接问题的故事板,但仍未解决。

参考:

  1. https://forums.developer.apple.com/thread/48959
  2. https://teamtreehouse.com/community/error-message-thread-1-signal-sigabrt-in-class-appdelegate
  3. 这是我的代码:

    import UIKit
    import CoreData
    import Parse
    import Bolts
    
    @available(iOS 10.0, *)
    @UIApplicationMain
    class AppDelegate: UIResponder, UIApplicationDelegate {
    
        var window: UIWindow?
    
    
        func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.
    
        // [Optional] Power your app with Local Datastore. For more info, go to
        // https://parse.com/docs/ios/guide#local-datastore
        Parse.enableLocalDatastore()
    
        // Initialize Parse. demo ID and Key
        Parse.setApplicationId("test123456789102293953543545",
            clientKey: "test09987654321234567890987654321")
    
        // [Optional] Track statistics around application opens.
        PFAnalytics.trackAppOpened(launchOptions: launchOptions)
    
        // Change the navifation background color
        UINavigationBar.appearance().barTintColor = UIColor(red: 216.0/255.0, green: 51.0/255.0, blue: 29.0/255.0, alpha: 1.0)
    
        // Change the navigation bar button color
        UINavigationBar.appearance().tintColor = UIColor.white()
    
        // Change the text font style and color
        if let barFont = UIFont(name: "AvenirNextCondensed-DemiBold", size: 22.0) {
            UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName:UIColor.white(), NSFontAttributeName:barFont]
        }
    
        // Change the status bar appearence
        UIApplication.shared().statusBarStyle = .lightContent
    
        // Change toolbar style
        // Font color
        // UIBarButtonItem.appearance().tintColor = UIColor(red: 255.0/255.0, green: 255.0/255.0, blue: 255.0/255.0, alpha: 0.5)
    
        // Background color
        // UIToolbar.appearance().barTintColor = UIColor(red: 237.0/255.0, green: 240.0/255.0, blue: 243.0/255.0, alpha: 0.5)
    
        // Edit tab bar appearence
        UITabBar.appearance().tintColor = UIColor(red: 216.0/255.0, green: 51.0/255.0, blue: 29.0/255.0, alpha: 1.0)
    
        UITabBar.appearance().barTintColor = UIColor.black()
    
        UITabBar.appearance().selectionIndicatorImage = UIImage(named: "tabitem_selected")
    
        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 throttle down OpenGL ES frame rates. 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 inactive 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:.
    }
    
    
    // MARK: - Core Data stack
    
    lazy var applicationDocumentsDirectory: URL = {
        // The directory the application uses to store the Core Data store file. This code uses a directory named "com.jiro9611.CoreDataDemo" in the application's documents Application Support directory.
        let urls = FileManager.default().urlsForDirectory(.documentDirectory, inDomains: .userDomainMask)
        return urls[urls.count-1]
    }()
    
    lazy var managedObjectModel: NSManagedObjectModel = {
        // The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model.
        let modelURL = Bundle.main().urlForResource("Zokoma", withExtension: "momd")!
        return NSManagedObjectModel(contentsOf: modelURL)!
    }()
    
    lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator = {
        // The persistent store coordinator for the application. This implementation creates and returns a coordinator, having added the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail.
        // Create the coordinator and store
        let coordinator = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel)
        let url = try! self.applicationDocumentsDirectory.appendingPathComponent("Zokoma.sqlite")
        var failureReason = "There was an error creating or loading the application's saved data."
        do {
            try coordinator.addPersistentStore(ofType: NSSQLiteStoreType, configurationName: nil, at: url, options: nil)
        } catch {
            // Report any error we got.
            var dict = [String: AnyObject]()
            dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data"
            dict[NSLocalizedFailureReasonErrorKey] = failureReason
    
            dict[NSUnderlyingErrorKey] = error as NSError
            let wrappedError = NSError(domain: "YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict)
            // Replace this with code to handle the error appropriately.
            // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
            NSLog("Unresolved error \(wrappedError), \(wrappedError.userInfo)")
            abort()
        }
    
        return coordinator
    }()
    
    
    lazy var managedObjectContext: NSManagedObjectContext? = {
        // Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) This property is optional since there are legitimate error conditions that could cause the creation of the context to fail.
        let coordinator = self.persistentStoreCoordinator
        var managedObjectContext = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
    
        managedObjectContext.persistentStoreCoordinator = coordinator
        return managedObjectContext
    }()
    
    // MARK: - Core Data Saving support
    
    func saveContext () {
        if managedObjectContext!.hasChanges {
            do {
                try managedObjectContext!.save()
            } catch {
                // Replace this implementation with code to handle the error appropriately.
                // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
                let nserror = error as NSError
                NSLog("Unresolved error \(nserror), \(nserror.userInfo)")
                abort()
                }
            }
        }
    }
    

    调试控制台错误消息(主题1:12主要)

    2016-06-20 17:27:54.918235 testdemo[11372:336115] bundleid: com.jiro9611.testdemo.testdemo, enable_level: 0, persist_level: 0, propagate_with_activity: 0
    2016-06-20 17:27:54.919918 testdemo[11372:336148] subsystem: com.apple.UIKit, category: HIDEvents, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0
    2016-06-20 17:27:54.967324 testdemo[11372:336115] Created DB, header sequence number = 252
    2016-06-20 17:27:55.212898 testdemo[11372:336115] Created DB, header sequence number = 252
    2016-06-20 17:27:55.817391 testdemo[11372:336115] subsystem: com.apple.BaseBoard, category: MachPort, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0
    2016-06-20 17:27:55.879995 testdemo[11372:336173] subsystem: com.apple.FrontBoard, category: Common, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0
    2016-06-20 17:27:56.123117 testdemo[11372:336315] subsystem: com.apple.network, category: , enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0
    2016-06-20 17:27:56.126025 testdemo[11372:336332] subsystem: com.apple.SystemConfiguration, category: SCNetworkReachability, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0
    2016-06-20 17:27:56.161570 testdemo[11372:336318] [] nw_host_stats_add_src recv too small, received 24, expected 28
    2016-06-20 17:27:56.161939 testdemo[11372:336318] [] nw_host_stats_add_src recv too small, received 24, expected 28
    2016-06-20 17:27:56.162781 testdemo[11372:336318] [] nw_host_stats_add_src recv too small, received 24, expected 28
    2016-06-20 17:27:56.163424 testdemo[11372:336318] [] nw_host_stats_add_src recv too small, received 24, expected 28
    2016-06-20 17:27:56.165271 testdemo[11372:336318] [] nw_host_stats_add_src recv too small, received 24, expected 28
    2016-06-20 17:27:56.166167 testdemo[11372:336318] [] nw_host_stats_add_src recv too small, received 24, expected 28
    2016-06-20 17:27:56.168272 testdemo[11372:336318] [] nw_host_stats_add_src recv too small, received 24, expected 28
    2016-06-20 17:27:56.169543 testdemo[11372:336318] [] nw_host_stats_add_src recv too small, received 24, expected 28
    2016-06-20 17:27:56.207060 testdemo[11372:336326] [] nw_endpoint_handler_start [1 api.parse.com:443 initial path (null)]
    2016-06-20 17:27:56.207989 testdemo[11372:336326] [] nw_connection_endpoint_report [1 api.parse.com:443 initial path (null)] reported event path:start
    2016-06-20 17:27:56.209468 testdemo[11372:336326] [] nw_connection_endpoint_report [1 api.parse.com:443 waiting path (satisfied)] reported event path:satisfied
    2016-06-20 17:27:56.212309 testdemo[11372:336326] subsystem: com.apple.SystemConfiguration, category: SCPreferences, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0
    2016-06-20 17:27:56.217287 testdemo[11372:336326] [] nw_connection_endpoint_report [1 api.parse.com:443 in_progress resolver (satisfied)] reported event resolver:start_dns
    2016-06-20 17:27:56.224829 testdemo[11372:336325] [] nw_endpoint_resolver_update [1 api.parse.com:443 in_progress resolver (satisfied)] Adding endpoint handler for 52.86.231.34:443
    2016-06-20 17:27:56.225499 testdemo[11372:336325] [] nw_endpoint_resolver_update [1 api.parse.com:443 in_progress resolver (satisfied)] Adding endpoint handler for 52.73.71.78:443
    2016-06-20 17:27:56.226195 testdemo[11372:336325] [] nw_endpoint_resolver_update [1 api.parse.com:443 in_progress resolver (satisfied)] Adding endpoint handler for 54.236.65.43:443
    2016-06-20 17:27:56.227043 testdemo[11372:336325] [] nw_endpoint_resolver_update [1 api.parse.com:443 in_progress resolver (satisfied)] Adding endpoint handler for 54.175.62.130:443
    2016-06-20 17:27:56.228196 testdemo[11372:336325] [] nw_endpoint_resolver_update [1 api.parse.com:443 in_progress resolver (satisfied)] Adding endpoint handler for 52.73.46.179:443
    2016-06-20 17:27:56.229822 testdemo[11372:336325] [] nw_endpoint_resolver_update [1 api.parse.com:443 in_progress resolver (satisfied)] Adding endpoint handler for 54.86.188.151:443
    2016-06-20 17:27:56.231173 testdemo[11372:336325] [] nw_endpoint_resolver_update [1 api.parse.com:443 in_progress resolver (satisfied)] Adding endpoint handler for 52.72.176.218:443
    2016-06-20 17:27:56.232084 testdemo[11372:336325] [] nw_endpoint_resolver_update [1 api.parse.com:443 in_progress resolver (satisfied)] Adding endpoint handler for 52.87.91.226:443
    2016-06-20 17:27:56.232605 testdemo[11372:336325] [] nw_connection_endpoint_report [1 api.parse.com:443 in_progress resolver (satisfied)] reported event resolver:receive_dns
    2016-06-20 17:27:56.233045 testdemo[11372:336325] [] nw_endpoint_resolver_start_next_child [1 api.parse.com:443 in_progress resolver (satisfied)] starting child endpoint 52.86.231.34:443
    2016-06-20 17:27:56.234173 testdemo[11372:336325] [] nw_host_stats_add_src recv too small, received 24, expected 28
    2016-06-20 17:27:56.236368 testdemo[11372:336325] [] nw_endpoint_resolver_start_next_child [1 api.parse.com:443 in_progress resolver (satisfied)] starting next child endpoint in 250ms
    2016-06-20 17:27:56.236919 testdemo[11372:336325] [] nw_endpoint_handler_start [1.1 52.86.231.34:443 initial path (null)]
    2016-06-20 17:27:56.237428 testdemo[11372:336325] [] nw_connection_endpoint_report [1.1 52.86.231.34:443 initial path (null)] reported event path:start
    2016-06-20 17:27:56.238535 testdemo[11372:336325] [] nw_connection_endpoint_report [1.1 52.86.231.34:443 waiting path (satisfied)] reported event path:satisfied
    2016-06-20 17:27:56.238915 testdemo[11372:336325] [] __nwlog_err_simulate_crash_libsystem libsystem simulate crash unavailable, [libsystem_network.dylib: nw_endpoint_get_hostname :: incorrect endpoint type 1]
    2016-06-20 17:27:56.239684 testdemo[11372:336325] [] nw_endpoint_get_hostname incorrect endpoint type 1, dumping backtrace:
            [x86_64] libnetcore-805.0.0.2.2
        0   libsystem_network.dylib             0x000000010934c37f __nw_create_backtrace_string + 123
        1   libsystem_network.dylib             0x000000010934e46e nw_endpoint_get_hostname + 75
        2   libnetwork.dylib                    0x00000001095bfbe7 nw_endpoint_proxy_handler_should_use_proxy + 125
        3   libnetwork.dylib                    0x00000001095cd04f nw_endpoint_handler_path_change + 1509
        4   libnetwork.dylib                    0x00000001095cc8a2 nw_endpoint_handler_start + 570
        5   libnetwork.dylib                    0x00000001095e3026 nw_endpoint_resolver_start_next_child + 2050
        6   libdispatch.dylib                   0x00000001090a51e8 _dispatch_call_block_and_release + 12
        7   libdispatch.dylib                   0x00000001090d1dee _dispatch_client_callout + 8
        8   libdispatch.dylib                   0x00000001090aca1d _dispatch_queue_serial_drain + 239
        9   libdi
    2016-06-20 17:27:56.241435 testdemo[11372:336325] [] nw_connection_endpoint_report [1.1 52.86.231.34:443 in_progress socket-flow (satisfied)] reported event flow:start_connect
    libc++abi.dylib: terminating with uncaught exception of type NSException
    (lldb)
    

    调试控制台错误消息“objc_release !!!!” (线程1:11 UIApplicationMain)

    UIKit`UIApplicationMain:
    0x1067c3dec <+0>:   pushq  %rbp
    0x1067c3ded <+1>:   movq   %rsp, %rbp
    0x1067c3df0 <+4>:   pushq  %r15
    0x1067c3df2 <+6>:   pushq  %r14
    0x1067c3df4 <+8>:   pushq  %r13
    0x1067c3df6 <+10>:  pushq  %r12
    0x1067c3df8 <+12>:  pushq  %rbx
    0x1067c3df9 <+13>:  pushq  %rax
    0x1067c3dfa <+14>:  movq   %rcx, %rbx
    0x1067c3dfd <+17>:  movq   %rsi, -0x30(%rbp)
    0x1067c3e01 <+21>:  movl   %edi, %r12d
    0x1067c3e04 <+24>:  movq   0xeb33e5(%rip), %r13      ; (void *)0x0000000108264d20: objc_retain
    0x1067c3e0b <+31>:  movq   %rdx, %rdi
    0x1067c3e0e <+34>:  callq  *%r13
    0x1067c3e11 <+37>:  movq   %rax, %r14
    0x1067c3e14 <+40>:  movq   %rbx, %rdi
    0x1067c3e17 <+43>:  callq  *%r13
    0x1067c3e1a <+46>:  movq   %rax, %r15
    0x1067c3e1d <+49>:  leaq   0xeb1478(%rip), %r13      ; _UIApplicationLinkedOnVersion
    0x1067c3e24 <+56>:  movl   (%r13), %eax
    0x1067c3e28 <+60>:  testl  %eax, %eax
    0x1067c3e2a <+62>:  jne    0x1067c3e3a               ; <+78>
    0x1067c3e2c <+64>:  cmpq   $-0x1, 0xeac3c4(%rip)     ; WebKitSetIsClassic + 7
    0x1067c3e34 <+72>:  jne    0x1067c3ead               ; <+193>
    0x1067c3e36 <+74>:  movl   (%r13), %eax
    0x1067c3e3a <+78>:  cmpl   $0x20100, %eax            ; imm = 0x20100 
    0x1067c3e3f <+83>:  jb     0x1067c3e65               ; <+121>
    0x1067c3e41 <+85>:  callq  0x10739c10c               ; symbol stub for: objc_autoreleasePoolPush
    0x1067c3e46 <+90>:  movq   %rax, %r13
    0x1067c3e49 <+93>:  movl   %r12d, %edi
    0x1067c3e4c <+96>:  movq   -0x30(%rbp), %rsi
    0x1067c3e50 <+100>: movq   %r14, %rdx
    0x1067c3e53 <+103>: movq   %r15, %rcx
    0x1067c3e56 <+106>: callq  0x1067c3ec5               ; _UIApplicationMainPreparations
    0x1067c3e5b <+111>: movq   %r13, %rdi
    0x1067c3e5e <+114>: callq  0x10739c106               ; symbol stub for: objc_autoreleasePoolPop
    0x1067c3e63 <+119>: jmp    0x1067c3e77               ; <+139>
    0x1067c3e65 <+121>: movl   %r12d, %edi
    0x1067c3e68 <+124>: movq   -0x30(%rbp), %rsi
    0x1067c3e6c <+128>: movq   %r14, %rdx
    0x1067c3e6f <+131>: movq   %r15, %rcx
    0x1067c3e72 <+134>: callq  0x1067c3ec5               ; _UIApplicationMainPreparations
    0x1067c3e77 <+139>: movq   0xeb1372(%rip), %rdi      ; UIApp
    0x1067c3e7e <+146>: movq   0xe23e2b(%rip), %rsi      ; "_run"
    0x1067c3e85 <+153>: callq  *0xeb3355(%rip)           ; (void *)0x0000000108267ac0: objc_msgSend
    0x1067c3e8b <+159>: movq   0xeb3356(%rip), %rbx      ; (void *)0x0000000108264d90: objc_release
    0x1067c3e92 <+166>: movq   %r15, %rdi
    0x1067c3e95 <+169>: callq  *%rbx
    0x1067c3e97 <+171>: movq   %r14, %rdi
    0x1067c3e9a <+174>: callq  *%rbx
    0x1067c3e9c <+176>: xorl   %eax, %eax
    0x1067c3e9e <+178>: addq   $0x8, %rsp
    0x1067c3ea2 <+182>: popq   %rbx
    0x1067c3ea3 <+183>: popq   %r12
    0x1067c3ea5 <+185>: popq   %r13
    0x1067c3ea7 <+187>: popq   %r14
    0x1067c3ea9 <+189>: popq   %r15
    0x1067c3eab <+191>: popq   %rbp
    0x1067c3eac <+192>: retq   
    0x1067c3ead <+193>: leaq   0xeac344(%rip), %rdi      ; _UIApplicationLinkedOnVersionOnce
    0x1067c3eb4 <+200>: leaq   0xeb68f5(%rip), %rsi      ; __block_literal_global.1569
    0x1067c3ebb <+207>: callq  0x10739c940               ; symbol stub for: dispatch_once
    0x1067c3ec0 <+212>: jmp    0x1067c3e36               ; <+74>
    

    调试控制台错误消息(线程1:13启动)

    libdyld.dylib`start:
    0x1091276bc <+0>: nop    
    0x1091276bd <+1>: movl   %eax, %edi
    0x1091276bf <+3>: callq  0x1091276f6               ; symbol stub for: exit
    0x1091276c4 <+8>: hlt   
    

    调试控制台错误消息(线程1:14启动)

    libdyld.dylib`start:
    0x1091276bc <+0>: nop    
    0x1091276bd <+1>: movl   %eax, %edi
    0x1091276bf <+3>: callq  0x1091276f6               ; symbol stub for: exit
    0x1091276c4 <+8>: hlt 
    

2 个答案:

答案 0 :(得分:3)

感谢所有给我建议的人,我终于解决了我朋友教给我的问题。我在这里分享这两个解决方案希望可以帮助其他像我一样面临类似问题的人。

  1. xcode 8 beta有时会错过断点。当我们调试时,我们设置了一些断点,但是xcode并没有停止在我们设置的地方。事实证明错误大约是我们之前设置的断点,但xcode 8 beta并没有就此止步......最终我们使用本土方法逐步测试我的代码。

  2. 真正的错误是因为&#34;核心数据&#34;代码表达式在swift 3.0中被更改,更重要的是,编写核心数据的新方法并不意味着它可以解决这个问题。

  3. 例如:

    旧路(swfit2.2): 它会导致xcode出现错误,所以你必须改变它

    let fetchRequest = NSFetchRequest(entityName: "Restaurant")
    

    新方式(swift3.0): 这是我犯的一个关键错误,我跟随别人的建议,改变旧的方式,xcode没有显示错误警告,所以我只是运行应用程序,它崩溃了!!没有任何特定的错误指向这个代码行,并像我说的xcode 8 deta有时无法在断点停止,所以它导致我们找到错误的方式。

    let fetchRequest: NSFetchRequest<NSFetchRequestResult> = Restaurant.fetchRequest()
    

    正确的新方式(swift3.0) 当我运行应用程序时,这是没有警告和正常工作的正确方法。

    let fetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: "Restaurant")
    

    所以,这就是我的解决方案,在Apple开发者论坛和一些stackoverflow帖子中,人们都有像我这样的每个类似错误消息,但解决方案都是不同的。祝你好运!

答案 1 :(得分:0)

通常,Thread 1: signal SIGABRT错误在末尾有一条消息,带有更多指示。在您的情况下,libc++abi.dylib: terminating with uncaught exception of type NSException

This SO answer说它可能来自故事板中断开的segue。 有时在迁移期间会发生。你能看看吗?

修改:抱歉,我刚看到您已经对此进行了测试。