CoreData:warning:Unable to load class named problem in Swift CoreData

Source: Internet
Author: User

Problem

When you create a CoreData project with Swift, the following error occurs when you operate CoreData modal

CoreData:warning:Unable to load class named "book" for the Entity ' book '.  Class not found, using the default Nsmanagedobject instead.
Solutions

1. Add @objc in Book.swift (book)

2. Modify the CoreData template

/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates/Core Data/nsmanagedobject subclass.xctemplate Copy to ~/Library/Developer/Xcode/Templates the next, if there is no Templates folder, create the folder templates

Modify the ___filebasename___.swift file, add @objc (___filebasenameasidentifier___), as follows

Import Foundationimport COREDATA@OBJC (___filebasenameasidentifier___) class ___filebasenameasidentifier___: ___ coredatamanagedobjectsuperclass___ {___coredatapropertyimplementations___}

Restart Xcode and the new Nsmanagedobject subclass will automatically add @objc ($className).

Reference: Http://stackoverflow.com/questions/25076276/unabled-to-find-specific-subclass-of-nsmanagedobject



CoreData:warning:Unable to load class named problem in Swift CoreData

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.