I updated my iOS app project recently to iOS 10. Now I\'m trying to change the Core Data Model of my app but the new NSManagedObject subclasses which Xcode generates are bro
I found this Post from David Atkinson which is helpful in some way. If I generate the code the way David described. I just get the code with some Syntax errors and if I fix the errors everything works like before. There are no missing files starting with '.' any more.
The syntax errors i Have to correct are - the unnecessary import - and some public properties which are not intended to be public in my code
If you have a legacy app and you wish to keep adding managed object classes manually
Delete the 3rd import
statement because it's empty.
Note: I don't know why this happens but I guess it's a bug in Xcode 8. Just delete it and it will work fine.
I think it is a xcode issue, where xcode generates wrong syntax for core data category class.
I am creating a nsmanageobjectsubclass
for one entity AgentDetails
Here xcode create wrong code structure in AgentDetails+CoreDataClass.h
and AgentDetails+CoreDataClass.m
. Those have a code structure like:
And
So it is having duplicate interface issue as AgentDetails.h
have same interface.
Now to fix this you have to change the code in AgentDetails+CoreDataClass.h
and AgentDetails+CoreDataClass.m
like this:
Try to set CodeGen: Manual/None Module: Current Product Module
It worked for me well, when I faced with the same problem.
You can try these steps
Is that work? If not
Make sure you all class has not the same name with Entities. You can find these class in Build Phases -> Compile Sources. Rename the class or Entities if they duplicated
Or
You can run this command to in your project folder to get more error info
xcodebuild -verbose
I got this message when i have this problem
duplicate symbol _OBJC_CLASS_$_RandomList in:
xxxx/RandomList.o
xxxx/RandomList+CoreDataClass.o
RandomList.h and RandomList+CoreDataClass.h have a same symbol when compiling
I think that why Xcode did not warn you, but Compiler will throw error
Hope this will help you