Receiver 'NSManagedObjectContext' for class message is a forward declaration 错误的解决方案

 

All the CoreData header files are imported in App_Prefix.pch, so the CoreData classes will be available throughout your Project, so you don't have to manually import the header in the files you need them.

So open up Xcode and look for some file like App_Prefix.pch, by default it's in the Other Sources group. After the UIKit import statement, add the following line:

#import <CoreData/CoreData.h>

And you should be ready to go.

Xcode 4

For projects created in Xcode 4, the prefix file can be found in the Supporting Files group in the Project navigator. It's called 'projectname-Prefix.pch' by default.

 

 

详见 http://stackoverflow.com/questions/2032818/adding-core-data-to-existing-iphone-project

 

 

PS:之前作为返回函数参数类型的NSManagedObjectContext并没有报错,但是在[[NSManagedObjectContext alloc] init]的时候,却突然报了标题的错误,让我没有联想到头文件引用那一块去,但实际上还是头文件没有引用的问题,还是觉得有点奇怪。 

 

另外:http://blog.csdn.net/kesalin/article/details/6739319 coredata框架写的不错

转载于:https://www.cnblogs.com/Kelphizy/p/4302846.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值