我正在使用:
当我运行附件代码时,我的应用程序在signal SIGABRT
类处崩溃,并出现AppDelegate
错误,并在控制台中显示了libc++abi.dylib: terminating with uncaught exception of type NSException
。
我试图运行一些调试程序,结果发现问题出在imageReference.delete{ (error) in }
方法中。
*请注意,它根本没有进入该块,它在方法本身中失败了,因为当我调用{时,该图像不是 not 从Firebase控制台中删除的{1}}方法。
我的代码:
delete
编辑:
经过非常深入的挖掘,我了解到我的问题是我正在“事件树”的某个位置通过闭包调用此方法(我正在调用某个函数,该函数调用另一个函数,而该函数又调用了func deleteImage(for url:String){
print(url) // https://firebasestorage.googleapis.com/v0/b/my-app.appspot.com/o/itemsImages%2F225121501531684886976.jpg?alt=media&token=token
let imageReference = Storage.storage().reference(forURL: url)
imageReference.delete { (error) in // Fails here with: libc++abi.dylib: terminating with uncaught exception of type NSException
print("completion") // Not getting to this point
if let error = error{
print(error)
}
}
}
的关闭方法),这就是导致问题的原因。
现在的问题是,如何通过此闭包调用它而不会出现此错误? (我不能在外面叫它)