更新到 Xcode 6.0 后,创建 NSManagedObject 子类不生成属性 [英] Create NSManagedObject subclass not generating property after updating to Xcode 6.0

查看:29
本文介绍了更新到 Xcode 6.0 后,创建 NSManagedObject 子类不生成属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新到 Xcode 版本 6.0 (6A313) 后,当我向 xcdatamodeld 条目添加新属性时,创建 NSManagedObject 子类"不会将新属性添加到生成的头文件中.这在关闭 Xcode 6 后运行良好,然后运行 ​​5.1.1 (5B1008) 版.我重复了几次这个过程,结果相同.我是否需要做一些事情来让新的 Xcode 版本正确管理我的数据模型,或重新创建它们,或者这可能只是新 Xcode 的一个错误?

After updating to Xcode Version 6.0 (6A313), when I add a new attribute to my xcdatamodeld entry, "Create NSManagedObject subclass" is not adding the new property to the generated header file. This works fine after closing Xcode 6, and then running Version 5.1.1 (5B1008). I repeated this process a couple of times with the same results. Do I need to do something to allow a new Xcode version to properly manage my data models, or recreate them, or is this possibly just a bug with the new Xcode?

以下是我采取的具体步骤:
1. 在 Xcode 6.0 (GM Seed) 中打开 DataModel.xcdatamodeld.
2. 选择正确的实体
3.点击+添加新属性
4. 为新属性输入名称和选择的布尔类型
5.编辑器->创建NSManagedObject子类
6. 确保检查了正确的数据模型,单击下一步
7. 确保检查了正确的实体,单击下一步
8. 选择保存位置(使用根项目文件夹),选择创建
9.在对话框中选择替换"
10. 在生成的头文件中查找变量.变量不存在.
11.关闭Xcode6
12.在Xcode 5.1.1中重复步骤1-10,运行正常
13. 重复此过程两次以验证相同的结果

Here are the specific steps I took:
1. Open DataModel.xcdatamodeld in Xcode 6.0 (GM Seed).
2. Select correct entity
3. Click + to add new attribute
4. Enter name and selected Boolean type for new attribute
5. Editor->Create NSManagedObject subclass
6. Ensure proper data model is checked, click next
7. Ensure correct entity is checked, click next
8. Choose location to save (using root project folder), select Create
9. Choose "Replace" in dialogue box
10. Look for variable in generated header file. Variable not present.
11. Close Xcode6
12. Repeat steps 1-10 in Xcode 5.1.1, worked correctly
13. Repeated this process twice to verify same results

感谢您的帮助!

推荐答案

好的,我想出了一个解决方法,但看起来这是一个错误.

Ok, I figured out a workaround but it would appear this is a bug.

对于要重新生成的所有实体,从磁盘中删除现有文件,尝试编辑器->创建 NSManagedObject 子类,然后选择已从磁盘中删除的那些类.

For all the entities you want to regenerate, remove the existing files from disk try Editor->Create NSManagedObject subclass and select those classes that you have removed from disk.

重新生成当前不存在的文件.这为我解决了这个问题.

The files that don't currently exist are regenerated. This fixed the issue for me.

这篇关于更新到 Xcode 6.0 后,创建 NSManagedObject 子类不生成属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆