- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 iOS 9.0、iPhone4 Simulator 和 Xcode 9.2 中使用 Core 数据。
加载 momd
文件时应用程序崩溃并显示 nil 值。
尽管我已经添加了 Address.xcdatamodel
文件来捆绑资源并选中了目标成员资格复选框。
lazy var managedObjectModelForAddress: 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 = Bundle.main.url(forResource: "Address", withExtension: "momd")!//Crashes here.
return NSManagedObjectModel(contentsOf: modelURL)!
}()
最佳答案
我使用了许多 .xcdatamodel
文件,其中一些适用于解决方案 1,一些适用于解决方案 2
解决方案 1:
.xcdatamodel
并将其保存在某处,然后重新添加。解决方案 2:
从模拟器中删除应用程序
创建新的 .xcdatamodel
并将所有内容复制到新的 .xcdatamodel
文件
关于swift - 无法在 ios 9 iPhone 4 模拟器中加载 momd 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51355501/
最近,我在大量处理核心数据,而让我感到烦恼的是,您创建了一个.xcdatamodeld来创建您的基本结构,然后通过xcode将其转换为.momd文件。 我的问题是:是否可以通过编程方式进行转换,而不是
我的应用程序使用 CoreData,模型名为:mupo-ios.xcdatamodel。该模型是原始模型的第二个版本:Model.xcdatamodeld。我通过文档使用 managedObjectC
我使用 Core Data 创建了一个主从应用程序。并且有一个简单的代码获取模型文件的路径: NSURL *modelURL = [[NSBundle mainBundle] URLForResour
大家好,我看到了this有疑问并用过 self.managedObjectContent= [NSManagedObjectModel mergedModelFromBundles:nil]; 但是,
对于我使用 CoreData 的 iOS 应用程序,我需要一个模型,其中某些实体属性在应用程序的 iPhone 和 iPad 版本之间有所不同。为此,我使用 initWithContentsOfURL
天哪!我搞砸了! 我是 Core Data 菜鸟,正在开发我的第一个 iOS 应用程序。经过多次堆栈溢出后,我正在使用这段代码: NSString *path = [[NSBundle mainBun
我在 iOS 9.0、iPhone4 Simulator 和 Xcode 9.2 中使用 Core 数据。 加载 momd 文件时应用程序崩溃并显示 nil 值。 尽管我已经添加了 Address.x
我最近将应用程序的语法从 Swift 2 升级到 Swift 3,应用程序现在崩溃并出现致命的错误: unexpectedly found nil while unwrapping an Option
在我的 iOS 应用程序中打开加载 map View 时出现错误。 map View 加载正常并出现在屏幕上,但是它没有加载到我初始化 map View 时设置的位置。 这是我用来实现 map Vie
我是一名优秀的程序员,十分优秀!