I have a few build schemes in my app, they are not much different, but I needed to have different info.plists for each scheme.
I created a class to store 2 strings, and made it conform to NSCoding so I could store it and retrieve it from standardUserDefaults.
On the 2 schemes that are not working, I get the following error:
I am running Xcode 7.2.1 (7C1002)
*** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: '*** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (Apps_Scheme_Test.UserLocationString) for key (root); the class may be defined in source code or a library that is not linked'
The first thing I thought was that I may have not included UserLocationString.swift in the target membership of those schemes. However, those schemes are checked.
I also checked the Build Phases and verified that UserLocationString.swift is included in the "Compile Sources" section.
What I did notice, is that is says object of class (Apps_Scheme_Test.UserLocationString)
Apps_Scheme_Test is the executable name of the ONE scheme that does work, and is NOT the proper name for the executable of the 2 that are not working.
So, it seems to me that my UserLocationString.swift object is somehow tied to the Apps_Scheme_Test executable, or something.
What can I do to, basically, "untie" that class from a specific scheme and let it work with any scheme that I create?
I haven't had this problem with any other classes/objects that I have created before, so it is a bit confusing.