Ambiguous use of 'encode(_:forKey:)'

Hello,

Im trying to save a custom object into coredata and it works fine on iOS but when trying to run the same code on the Mac Catalyst version of my app I get an error

Ambiguous use of 'encode(_:forKey:)'

I created a class for the object. I made it type NSObject & NSSecureCoding. I tried to make it encode and decode and save to CoreData with a transformer. Works on iOS version of my app but not macOS. Why is that?

Ty

Apparently, there's a long standing bug in Xcode there: https://stackoverflow.com/questions/64892915/ambiguous-use-of-objectforkey-in-xcode-12

They provide a workaround.

You may also look here: https://stackoverflow.com/questions/64253460/looking-for-a-fix-for-swift-ambiguous-use-of-objectforkey

Hope that helps.

I just enabled Catalyst in my app and encountered the same issue. Did you find a solution?

No I didnt pursue this further

Ambiguous use of 'encode(_:forKey:)'
 
 
Q