在Xcode 4中集成mogenerator [英] Integrate mogenerator within Xcode 4
问题描述
在我的应用程序中,我使用Core Data的东西来启用持久性数据保存。因为我已经看到,mogenerator提供了一个好的方法来创建和维护 NSManagedObject
子类(还有额外的功能),我在寻找一些提示,以集成单生成器在Xcode 4 ?
PS此问题已根据分享您的知识提交,
$ p对于Xcode 4.5+,最简单的方法是设置一个动作:
- 编辑您要制作的方案
- 打开
- 点击+并添加新建运行脚本操作
-
<$> c $ c>#更新mogenerator文件
cd $ {SOURCE_ROOT} / $ {PROJECT_NAME}
/ usr / bin / mogenerator --template-var arc = true -m $ {PROJECT_NAME} .xcdatamodeld - 点击确定并生成 p>
将在源文件区域中创建一个名为CoreData的目录以及子目录Human和Machine 。您现在应该将CoreData文件夹添加到您的项目中。
In my application I'm using Core Data stuff to enable persistent data saving. Since I've seen that mogenerator provides a good approach to create and maintain NSManagedObject
subclasses (also with additional functionalities), I'm looking for some tips for integrating monogenerator within Xcode 4?
P.S. The question has been submitted based on share your knowledge, Q&A-style.
For Xcode 4.5+, the easiest way is to setup a "Pre-action" in your scheme:
- Edit the scheme you want to build
- Open the "Build" item and select "Pre-actions"
- Click on the "+" and add a "New Run Script Action"
- In the "Provide build settings from" popup, use the target
Paste this in the text area:
# Update the mogenerator files cd ${SOURCE_ROOT}/${PROJECT_NAME} /usr/bin/mogenerator --template-var arc=true -m ${PROJECT_NAME}.xcdatamodeld -M CoreData/Machine -H CoreData/Human`
Hit "OK" and build
A directory named "CoreData" will be created in your source file area along with the subdirectories "Human" and "Machine". You should now add the "CoreData" folder to your project.
这篇关于在Xcode 4中集成mogenerator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!