在Xcode 4中集成mogenerator [英] Integrate mogenerator within Xcode 4

查看:180
本文介绍了在Xcode 4中集成mogenerator的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我使用Core Data的东西来启用持久性数据保存。因为我已经看到,mogenerator提供了一个好的方法来创建和维护 NSManagedObject 子类(还有额外的功能),我在寻找一些提示,以集成单生成器在Xcode 4 ?



PS此问题已根据分享您的知识提交,

$ p

解决方案

对于Xcode 4.5+,最简单的方法是设置一个动作:


  1. 编辑您要制作的方案

  2. 打开

  3. 点击+并添加新建运行脚本操作

  4.  <$> 

    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:

  1. Edit the scheme you want to build
  2. Open the "Build" item and select "Pre-actions"
  3. Click on the "+" and add a "New Run Script Action"
  4. In the "Provide build settings from" popup, use the target
  5. 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`
    

  6. 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屋!

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