Xcode 8 generates broken NSManagedObject subclasses for iOS 10

后端 未结 22 934
栀梦
栀梦 2020-11-27 11:13

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

22条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-27 12:07

    You can try these steps

    1. Select the .xcdatamodeld file in Xocde Project Navigator
    2. In the Data Modul Inspector, make sure Codegen : Manual/None
    3. Then Edit -> Create NSManagedObject Subclass
    4. Clean product and rebuild

    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

提交回复
热议问题