You generate files that Xcode has already created for you, and thus receive duplicate ads. Detailed information about this feature (new in Xcode 8) can be found in this WWDC video .
Two possible fixes:
1) Use subclasses of ManagedObject created under Xcode (recommended, modern approach)
- Remove all created NSManagedObject subclasses from your project, if they exist.
- Set
Codegen to Class Definition in .xcdatamodel for all objects - Make sure
Module blank (Global Namespace is light gray) (Apple workaround, see this answer )

Note:
Never add automatically generated files to your project. Even you do not see the generated files in your project, Xcode has a link to it, so you can write extensions, etc. For instance:
extension MyEntity { func doSomething() {
Alternatively, you can invoke + click on the generated file in Xcode.
2) Manually generating a trigger subclass (a rather paranoid, but bulletproof approach, ignoring the new Xcode features)
- Remove all created NSManagedObject subclasses from your project, if they exist.
- Set
Codegen to Manual/None in .xcdatamodel for all objects - Clear project
- Empty DerivedData folder
- Restart xcode
- Manually subclass
NSManagedObject (in the Editor menu) - Make sure these files are added to your project.
- to build
source share