我安装了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.
上述陈述有几个问题尚不清楚:
.xcdatamodel
文件使用mogenerator的唯一方法?有什么方法可以手动运行 mogenerator 以便它重新创建生成的文件? 最佳答案
还有一点需要注意:您必须已经将实体的 Class 属性设置为不同于 NSManagedObject 的东西。否则 Xmo'd 不会做任何事情。
备注 : Xmo'd 目前不适用于 Xcode 4/5,afaik。
我所做的只是在 Xcode 中添加一个“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/