Core Data: Could not cast value of type 'MyType_MyType_2' to MyType

前端 未结 4 1883
温柔的废话
温柔的废话 2020-12-29 21:10

I have an Objective-C model class MyType. This class is used in Swift code:

NSEntityDescription.insertNewObjectForEntit         


        
4条回答
  •  余生分开走
    2020-12-29 21:45

    just try this:

    @objc(MyType)
    public class MyType: NSManagedObject {
        // your class
    }
    

    instead of this:

    class MyType: NSManagedObject {
        // your class
    }
    

提交回复
热议问题