I'm using Swift on Xcode 6 with CoreData
.
I've read the release notes and have seen this issue about making sure to mark up a core data model with a module name (app name) so you can cast an NSManagedObject
to your model type at run time.
When I do this, I can get an app to run properly (good!). However, my issue is, when I try to test that same code, the test will always crash whenever the cast happens with a Swift dynamic cast failed
error (bad :(). This makes it difficult to test my application.
Is there any impact on the module name we use when the app is built for test vs. running?
Thanks in advance for any pointers...
Follow up:
This is not ideal:
As noted above, In order for Swift to use a Core Data model, you need to decorate the class name with the name of your app. This works find for building the app, but the tests run under a different app name! That means you need to go into the data modeler and change that class name from myAppname.myEntity
to myAppnameTests.myEntity
before you can use those Entities by name when used by or called from a test.