iOS Swift how to debug SIGABRT :"fatal error: call of deleted method" from a CocoaPod?

Viewed 8016

I have an app which uses SlideMenuControllerSwift. I've modified some code to see how to present different panels, then rolled back my changes.

When running the project I get SIGABRT fatal error: call of deleted method in console when SlideMenuControllerSwift is initializing. No other error messages are given.

  • The project's source control appears to be in exactly the same state as before changes.
  • I did a "clean"
  • Reinstalled pods.
  • Deleted pods directory and made a clean install
  • Deleted app from device and ran again
  • Did a fresh checkout into a different folder
  • Updated cocoapods gem
  • Even modified the function to use self.addLeftGestures()

How do I debug an issue caused by cocoa pod throwing "fatal error: call of deleted method"?

enter image description here

UPDATE: seems like something is seriously broken with the functions inside that pod, calling another function within init causes bad access exception:

enter image description here

2 Answers

In my case, I had created a project scheme that uses the release build configuration:

Edit Scheme

In this configuration, if your project build settings does not allow testability in this release mode then setting custom breakpoints or app crashes do not let you debug properly and you are served the fatal error: call of deleted method


Solution:

Check the project build settings for "testability".

Project Build Settings

Ensure it is "Yes" for the build configuration you are testing under.

In my case, I temporarily enabled testability for Release by making it Yes.

For anyone seeing this error using SwiftUI on XCode 11.4 and trying to access a property on an ObservableObject subclass eg.

class Model: ObservableObject {
    @Published var name = ""
}

class ModelSub: Model {}

let model = ModelSub()

// This line causes `fatal error: call of deleted method` on XCode 11.4
$model.name

// Instead do 
model._name.projectedValue

See more details here

Related