ios - swift 崩溃报告 `function signature specialization`

标签 ios swift crash

我收到了神秘的崩溃报告,我终究无法弄清楚到底是什么原因导致了这个错误。但是,我不是熟练的 iOS/Swift 开发人员,所以对其他人来说这可能是显而易见的!

这是堆栈:

function signature specialization <Arg[1] = Value Promoted from Box> of closure #1 () -> () in Company.LoginViewController.(logIn in _10D245F74F8D2701C8F7339313EB1733)() -> ()
LoginViewController.swift - line 275
SIGABRT

libsystem_kernel.dylib
__pthread_kill
libsystem_c.dylib
abort
libswiftCore.dylib
0x103964000 + 2666636
libswiftCore.dylib
0x103964000 + 2666896
libswiftCore.dylib
0x103964000 + 2869624
Company
function signature specialization <Arg[1] = Value Promoted from Box> of closure #1 () -> () in Company.LoginViewController.(logIn in _10D245F74F8D2701C8F7339313EB1733)() -> () LoginViewController.swift:275
Company
_T0Ieg_IeyB_TR LoginViewController.swift:0
Company
_T0So8NSStringCIeyBy_SSIegx_TRTA AuthenticationManager.swift:0
Company
function signature specialization <Arg[0] = Owned To Guaranteed> of closure #1 (__ObjC.AFOAuthCredential) -> () in Company.AuthenticationManager.authenticate(with: Swift.String, password: Swift.String, success: (Swift.String) -> (), failure: (__ObjC.INTAuthenticationError) -> ()) -> () AuthenticationManager.swift:105

相关函数如下:

private func logIn() {
    beginAuthentication()

    let credentials = INTUserCredentials()
    credentials.username = email.text
    credentials.password = password.text

    authenticationModel.logIn(with: credentials, success: { [unowned self] in
// *** Crashes here, oddly on an empty line ***
        let finish = { [weak self] in
            self?.endAuthentication()
            if let delegate = self?.delegate {
                delegate.authenticationViewControllerDidLogin(self?.registrationInfoContainer)
            }
        }
    }, failure: { [weak self] errorMessage in
        self?.showErrorMessage(errorMessage)
    })
}

最佳答案

是否有可能您引用为自身的对象(LoginViewController?)正在被处置?我可以想象,您的 authenticationModel 类的函数 logIn 的签名需要非可选属性。但是,在调用 logIn() 函数后,该对象不再被使用并被处置(因为 [unowned self])...只需在您的 dealloc 函数中放置一个断点,看看会发生什么。对了,dealloc函数不能为空才能让断点停止

关于ios - swift 崩溃报告 `function signature specialization`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50408200/

相关文章:

ios - 签名无效。密封资源丢失或无效(在 Android Studio 中使用 RoboVM)

ios - 我如何使用 jwplayer 在 IOS 设备上播放 mp4 视频

swift - 使用AVPlayer从MacOS Swift应用程序将音频定向到空中播放扬声器

swift - iOS 9.1 中的 "This app does not have access to your photos and video"

ios - 崩溃并出现错误 : EXC_BAD_ACCESS KERN_INVALID_ADDRESS

ios - YTPlayerView - 对 YTPlayerView 的自动旋转支持

ios - 从 UITableViewCell 内的 url 播放音频

swift - 跳转到 swift - json 字典数组的问题

android - Nougat 7.0 上的应用程序 "keeps stopping"

iphone - 应用程序在关闭presentModalViewController后崩溃