Ios 重命名项目导致managedObjectModel出错

Ios 重命名项目导致managedObjectModel出错,ios,xcode7,Ios,Xcode7,我试图在XCode7中重命名一个项目。重命名后,它可以正常编译,但我在这个代码块中遇到运行时错误: lazy var managedObjectModel: NSManagedObjectModel = { // The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find

我试图在XCode7中重命名一个项目。重命名后,它可以正常编译,但我在这个代码块中遇到运行时错误:

lazy var managedObjectModel: NSManagedObjectModel = {
    // The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model.
    let modelURL = NSBundle.mainBundle().URLForResource("Test File", withExtension: "momd")!
    return NSManagedObjectModel(contentsOfURL: modelURL)!
}()
我得到的例外是:

向上向下计数[6149:4086716]CoreData:无法加载URL为的NSManagedObjectModelfile:///Users/Scott/Library/Developer/CoreSimulator/Devices/C66F52A5-3979-4D8D-A80D-337FDDCFDB29/data/Containers/Bundle/Application/B4D6F673-6EA9-446D-B29E-F769EAC33B38/Test%20File.app/Test%20File.momd/' 致命错误:在展开可选值时意外发现nil

我试着重新设置模拟器,但它什么也没做


我以前重命名过项目,没有任何问题。这是我尝试重命名的第一个包含核心数据的文件。

您是否验证了应用程序包中是否存在
测试文件.momd
?我看不到它。我深入到异常中所示的文件夹,那里没有多少内容。问题是,当我将项目重新命名为其原始名称时,一切都开始正常工作。检查错误链接是否存在您以前的项目名称?当我查看NSBundle.mainBundle时,我看到的路径与我可以深入查看的路径相同。在该路径中,我看到一个名为Test file.app的文件。当我重命名为原始文件名时,我也检查了它,对于.app文件也是如此。唯一的区别是,它在let modelURL=NSBundle.mainBundle().URLForResource(“测试文件”,扩展名为“momd”)上失败!在我重新命名项目之后。我刚刚知道如何查看.app文件。其中确实有一个名为Test file.momd的文件。检查一下这个@ScottKilbourn