xcode - 如何使用 Mogenerator?

标签 xcode plugins core-data installation mogenerator

我安装了Mogenerator .现在我该怎么办?我该如何使用它?

我遇到的第一个问题是我不知道它安装在哪里。在安装过程中,它只让我选择要安装它的硬盘驱动器,而不是目录。最自然的位置是 Applications文件夹,但它不存在。

接下来,readme (我在网上找到的)说:

Xmo'd works by noticing when your *.xcdatamodel is saved. If the model file's Xcode project item comment contains xmod, an AppleScript is fired that creates a folder based on your model's file name and populates it with derived source code files from your model. It then adds the new folder to your project as a Group Reference and adds all the source files to your project.



上述陈述有几个问题尚不清楚:
  • “模型文​​件的 Xcode 项目项注释”指的是什么?我怎样才能让它包含“xmod”?
  • 正在添加此评论并让 mogenerator 监控 .xcdatamodel文件使用mogenerator的唯一方法?有什么方法可以手动运行 mogenerator 以便它重新创建生成的文件?
  • 最佳答案

    还有一点需要注意:您必须已经将实体的 Class 属性设置为不同于 NSManagedObject 的东西。否则 Xmo'd 不会做任何事情。

    备注 : Xmo'd 目前不适用于 Xcode 4/5,afaik。

    我所做的只是在 Xcode 中添加一个“MOGenerator”目标:

  • 转到您的项目并单击“目标”部分中的“添加目标...”。
  • 选择“iOS -> 其他 -> 聚合”
  • 转到“构建阶段”
  • 从菜单中选择“编辑器 -> 添加构建阶段 -> 添加运行脚本构建阶段”
  • 将 MOGenerator 命令粘贴到运行脚本部分,例如:

  • PATH=${PATH}:/usr/local/bin    
    cd "${PROJECT_DIR}/MyApp"
    mogenerator --human-dir Classes --machine-dir MOGenerated --model MyApp.xcdatamodeld/MyApp.xcdatamodel --template-var arc=true
    

    现在您可以通过简单地运行此目标来更新您的 MOGenerator 生成的。

    关于xcode - 如何使用 Mogenerator?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3563145/

    相关文章:

    objective-c - mfmailcomposer 剪切 html 电子邮件的结尾

    ios - 导航栏项目不可见

    objective-c - 如何编写 OS X Finder 插件

    javascript - 从 Javascript 重新加载 Chrome 中的 flash 插件

    jquery - 同一页面中的两个jquery分页插件似乎不起作用

    objective-c - 核心数据和REST

    ios - 清理后,managedObjectContext 为 nil 并导致 fatal error : unexpectedly found nil while unwrapping an optional value

    iphone - ReloadTable 使应用程序崩溃

    iphone - 如何调整 XCode Organizer GUI?

    iphone - 将现有数据导入核心数据