Given an SDK I am trying to present its view in an Ionic-Capacitor app.

self.bridge?.viewController is available with it's present method from a Capacitor import

After loading the SDK, using: self.bridge?.viewController?.present(someController, animated: true, completion: nil)

Produces the following error:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSJSONSerialization dataWithJSONObject:options:error:]: value parameter is nil' terminating due to uncaught exception of type NSException

There are no errors indicated in the source code. When I inspect the error it leads me to the top of AppDelegate. Any suggestions are welcome on how to fix this.

1

There are 1 best solutions below

2
Andrew Arrow On

I'll bet it's a Circular reference (or unsupported data types) cashing the JSON serialization error. But you need more information. Dive in and put in print statements:

https://andrewarrow.substack.com/p/installing-go-from-source-to-debug

i.e. you need to see line by line where the issue is. You need to edit the source code of this SDK and/or use XCode break points but I like prints statements way better.