[英]xcode8 beta4 not generating the managedObjectContext
I am using a blank core data proj and trying to copy the code from this examples.我正在使用一个空白的核心数据项目并尝试从这个示例中复制代码。
https://www.and rewcbancroft.com/2015/02/18/core-data-cheat-sheet-for-swift-ios-developers/ https://www.and rewcbancroft.com/2015/02/18/core-data-cheat-sheet-for-swift-ios-developers/
As there is no managedContext i am not able o proceed.由于没有 managedContext 我无法继续。
I am new to IOS programming.我是 IOS 编程的新手。 Please can anybody share me a simple example that i can start with.请任何人都可以分享我一个简单的例子,我可以开始。 But i need it with Xcode8 beta4 version.但我需要 Xcode8 beta4 版本。 I tried many other examples but once i convert them to my current version they are not working.我尝试了许多其他示例,但是一旦我将它们转换为当前版本,它们就无法正常工作。
The error message reads:错误信息如下:
Value of type 'ViewController' has no member 'managedObjectContext' “ViewController”类型的值没有成员“managedObjectContext”
What this means is that somewhere (your screenshot does not show where) you are attempting to assign a value to a property named managedObjectContext
, on an instance of your ViewController
class.这意味着在某个地方(您的屏幕截图未显示在哪里),您正试图在ViewController
类的实例上为名为managedObjectContext
的属性赋值。 Except that this class doesn't have a property named managedObjectContext
, so Swift complains and doesn't compile.除了这个类没有一个名为managedObjectContext
的属性,所以 Swift 会抱怨并且不会编译。
This is not actually a Core Data question-- it's basic Swift.这实际上不是核心数据问题——它是基本的 Swift。 It would happen for any attempt to assign a value to a nonexistent property.任何为不存在的属性赋值的尝试都会发生这种情况。
You probably (again, your screenshot does not provide enough detail to be sure) need to create this property on your view controller class, with type NSManagedObjectContext
.你可能(同样,你的截图没有提供足够的细节来确定)需要在你的视图控制器类上创建这个属性,类型为NSManagedObjectContext
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.