Master Data: Unable to load class named "CDAccount"

I recently downloaded iOS 8 to make sure my existing application is working correctly with it, but I get a warning in the debugger on startup:

"CoreData: warning: Unable to load class named 'CDAccount' for entity 'CDAccount'. Class not found, using default NSManagedObject instead." 

After some research, it seems that people had similar problems when using Core Data in Swift, but all my code is in Objective-C (and the data model has not changed for at least 6 months).

Any advice is greatly appreciated, I'm very nervous that my application will not function properly once people start upgrading to iOS 8!

+5
source share
5 answers

I had the same problem in Objective-C and Xcode 6. For some reason, Xcode removed my CustomNSManagedObject'.m classes from my compilation sources.

Go to your project goal -> Build phases -> Compile sources and use the + button to add CDAccount.m

If you use Mogenerator to create the _CDAccount.m file, add it to your compilation sources.

+17
source

Remove the "dot" in the "Default" configurations on .xcdatamodeld:

enter image description here

so that:
enter image description here
enter image description here
Rebuild the application.

+7
source

This seems to be a Xcode bug / issue. I am using Xcode 6.3.1

  • click on your main data object (xxx.xcdatamodeld), then select the object, and in the attribute inspector you will see that the name of the entity class is set to PRODUCT_MODULE_NAME.xxx, where "xxx" is your object name.

Solution: You must replace PRODUCT_MODULE_NAME with your application name.

If you doubt the name of your application, check it in the "Build Settings" section, select "product_module_name", and you will find your application name under "packaging"

  • in some cases (my case) the data model file (swift or objective-c) is also deleted by Xcode from the project - it is still included on the disk, but you need to add it again. Therefore, in this case, take the CDAccount.m file and run it again in your project (or use another method for this)
+2
source

My problem was also similar, but the reason was that the object module was not installed.

module selection in Entity properties menu

+2
source

My problem was similar, but the solutions listed did not work, because my CD classes were stored as part of. The solution was to change the representation of the class name to "frameworkName.className". However, xcdatamodeld did not allow me to change it to this, so I had to “show the contents” in the file, open the “contents” file in Xcode and make the changes myself.

0
source

Source: https://habr.com/ru/post/1202466/


All Articles