xcode 7种使用coredata遇到 Class not found, using default NSManagedObject instead.问题
2015-11-04 17:12
543 查看
CoreData: warning: Unable to load class named 'CoreDataSwift2_2.Bowtie' for entity 'Bowtie'. Class not found, using default NSManagedObject instead. fatal error: NSArray element failed to match the Swift Array Element type xcode 7 中遇到这种问题纠结了好久,最终解决了。
This warning is quite annoying. It appears spuriously. I have been able to get rid of it in most cases by making sure that the class is set correctly in the model editor. Unlike in many other SOF posts, the suggestion to include the module name (like
MyApp.Shows) has not helped me.
1.
Version that works up to Xcode 7 beta 3
Notice that I corrected your entity name to the more appropriate singular.
Version that works for Xcode 7 beta 4 and above
You need to delete the text "Current Product Module" in Module!
2.
You should also follow the frequent recommendation to include
@objc(Show)
just above your class.
Note: If you are using Xcode 7 beta 4 or later, this step is optional.
3.
Also make sure to cast the created managed object to the proper class, as the default would be just
NSManagedObject.
var newShow = NSEntityDescription.insertNewObjectForEntityForName("Show", inManagedObjectContext: context) as Show
相关文章推荐
- extend&super&Object&Abstract
- Xamarin演练:绑定一个Objective-C类库
- Object类
- NSObject--block
- [论文笔记4]Robust Object Detection via soft cascade
- Objective-C之代理设计模式小实例
- objective-c基础教程——学习小结
- Windows下的Objective-C集成开发环境(IDE)
- 关联(objc_setAssociatedObject、objc_getAssociatedObject)
- objective-C protocol协议
- Windows 下使用 GNUstep 编译并运行 Objective-C 程序
- Objective-C学习笔记之block
- 【Objective-C】Windows下Objective-C开发环境配置
- Odoo8查询产品时提示"maximum recursion depth exceeded while calling a Python object"
- Objective-C Blocks Quiz
- 如何使用swfobject(中文版)
- 黑马程序员-------Objective-C基础2
- Objective-C中变量采用@property的各个属性值的含义
- (原创)c#学习笔记09--定义类02--System.Object
- 全面解析Objective-C中的block代码块的使用