我正在使用:
-
iOS-斯威夫特4
-
椰子1.4.0
-
火碱(5.4.0)
-
火基芯(5.0.5)
-
火基储存(3.0.0)
当我运行附加的代码时,我的应用程序崩溃
signal SIGABRT
错误出现在
AppDelegate
课程和印刷品
libc++abi.dylib: terminating with uncaught exception of type NSException
在控制台中。
我尝试运行一些调试,发现问题发生在
imageReference.delete{ (error) in }
方法。
*请注意,它根本没有进入到块中,它在方法本身中失败,因此图像是
不
当我调用FireBase控制台时从中删除
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)
}
}
}
编辑:
在深入挖掘之后,我了解到我的问题是,我正在通过在“事件”树的某个点上关闭来调用此方法(我正在调用某个函数,该函数调用另一个函数,该函数调用
删除
方法),这就是导致问题的原因。
现在的问题是,如何通过这个闭包调用它而不犯这个错误?(我不能在外面叫它)