Swift 3 - 线程 1:EXC_BAD_INSTRUCTION(代码 = EXC_I386_INVOP,子代码 = 0x0)

Swift 3 - Thread 1: EXC_BAD_INSTRUCTION (code = EXC_I386_INVOP, subcode = 0x0)

我正在尝试使用 AWS Cognito 作为后端将用户身份验证功能添加到我的应用程序中。

到目前为止,每当我的应用程序尝试构建时我都会收到此错误,当它构建时它指向我的两个 类.

中的这些错误

AWSMobileClient Class:

func didFinishLaunching(application: UIApplication, withOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
    print("didFinishLaunching:")


    let didFinishLaunching = AWSIdentityManager.defaultIdentityManager().interceptApplication(application, didFinishLaunchingWithOptions: launchOptions)

    if (!isInitialized) {
        AWSIdentityManager.defaultIdentityManager().resumeSession(completionHandler: {(_ result: AnyObject, _ error: Error) -> Void in
            print("result = \(result), error = \(error)")
        } as! (Any?, Error?) -> Void) --> ERROR ON THIS LINE <--
        isInitialized = true
    }
    return didFinishLaunching
}

AppDelegate Class:

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.
    return AWSMobileClient.sharedInstance.didFinishLaunching(application: application, withOptions: launchOptions as [NSObject : AnyObject]?) --> ERROR ON THIS LINE <--

看起来 AWS MobileHub 示例代码还不兼容 swift3——这就是我要 运行 的原因;也许你也是?请参阅 here 以获取来自 AWS 的回答,以及使用旧版编译器设置的提示(我还没有整理出来...)