生成在包中丢失的.mom文件中生成.momd [英] Build is producing a .momd in the bundle that is missing the .mom file

查看:103
本文介绍了生成在包中丢失的.mom文件中生成.momd的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在iPhone模拟器上运行良好的应用程序已有一段时间了。最近,我决定要在另一个项目中重用数据模型和相关类-因此我将它们从该项目窗口拖到另一个窗口中,然后告诉Xcode不要复制,只是为了进行引用。起初这没有用,所以我跳了很多圈来解决它(我可能会在另一篇文章中问更多有关此问题的信息)。完成所有这些操作后,我重新编译并尝试运行原始应用程序-该应用程序不再起作用。在进一步调查中,我发现当我重新编译原始应用程序时,最终得到一个包含.momd包的包,但它仅包含Versioninfo.plist文件-没有.mom文件,没有像我这样的.omo文件。我期待看到。我不记得要对原始应用进行任何更改。我没有收到任何警告。我只是得到了一个不完整的.momd程序包(而且,我的应用现在崩溃了,这并不奇怪。)

I have an app that has been running fine on the iPhone simulator for some time. Recently, I decided I wanted to re-use the data model and related classes in another project - so I dragged them from this project window to the other then told Xcode not to copy, just to make references. At first this didn't work so I jumped through a number of hoops to try to fix it (I may be asking more about that in another post). After all this, I re-compiled and tried to run the original app -- and it's not working any more. On further investigation, I discovered that when I re-compile the original app, I end up with a bundle that contains a .momd package but it contains only a Versioninfo.plist file - no .mom file, no .omo file like I'm expecting to see. I don't recall making any changes to the original app. I don't get any warnings. I just get an incomplete .momd package (and, not surprisingly, my app now crashes).

这里发生了什么?

BTW,应用程序现在崩溃,并显示以下消息:
由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:' * -[__ NSArrayM insertObject:atIndex:]:对象不能为nil'

BTW, the app now crashes with this message: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[__NSArrayM insertObject:atIndex:]: object cannot be nil'

执行以下代码行会得到以下信息:

Which I get when executing this line of code:

self.productRegistry = [[UIManagedDocument alloc] initWithFileURL:self.productRegistryURL];


推荐答案

我通过更仔细地查看文件来解决这个问题使用Finder在项目目录中的位置。在Xcode窗口中,一切看起来都很正常,但是在实际的项目目录中,我发现.datamodeld包最终出现在项目目录的顶层,与项目包本身处于同一级别。 Xcode显然不喜欢这样,但是不幸的是它没有抱怨-它只是创建了部分构建输出。将.datamodeld程序包与项目其余代码一起移到同一文件夹后,一切正常。

I figured this out by looking more closely at the file locations in the project directory using Finder. In the Xcode window, everything looks normal but in the actual project directory I found that the .datamodeld package had ended up at the top level of the project directory -- at the same level as the project package itself. Xcode apparently did not like this but unfortunately it did not complain -- it just created a partial build output. Once I moved the .datamodeld package into the same folder as the rest of the project's code, everything worked just fine.

这似乎只是一个怪癖。我希望Xcode会看到一切都很好并且可以正确构建,或者会看到事情不尽如人意而失败。在这种情况下,它无法正确构建,但对此保持沉默。

This would appear to be just a quirk. I would expect that Xcode would either see that all is well and build correctly OR it would see that things weren't quite as they should be and fail. In this case, it did not build correctly but was silent about it.

希望这个答案有一天能对其他人有所帮助。

Hope this answer helps someone else someday.

这篇关于生成在包中丢失的.mom文件中生成.momd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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