I’m trying to archive one of my classes via NSCoding but one of the properties is JSON. I’m using SwiftyJSON to convert the JSON to NSData with the encodeWithCoder method but I occasionally get a fatal error: “‘NSInvalidArgumentException’, reason: ‘*** +[NSJSONSerialization dataWithJSONObject:options:error:]”.
I was having the same issue. Instead of converting the JSON to NSData I converted it to a String and then encoded that instead. That’s been working for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With