I will try to explain my situation:
I have an app that has two frameworks: one for iOS and one for watchOS. There are shared source files between the two as well as target specific source files.
I will name them: MyAppFrameworkKit and MyAppFrameworkKitLite with the "lite" one being on watchOS.
To allow communication between the two, I have created a MyAppEventMessage class that is serializable with NSSecureCoding.
However, and this makes sense now, when I serialize this object and send it to the iOS side, there is a NSKeyedUnarchiver crash:
*** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: '*** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (MyAppFrameworkKitLite.MyAppEventMessage) for key (root); the class may be defined in source code or a library that is not linked'
Now this makes sense to me because MyAppFrameworkKitLite is *not* linked from the iOS side. The iOS version is linked to the MyAppFrameworkKit. Even though they share the same MyAppEventMessage class in their frameworks, the module names are obviously not the same.
How are developers serializing information between their iOS and watchOS apps? As far as I can tell, it is not possible to have both targets link against a framework with the same module name while also targeting iOS or watchOS.
I would hate to have to include these files in the source of my apps instead of their respective framework as I like the separation.
Any help or clarifiaction is much appreciated