为什么Xcode说“找不到类型' nspersistentContainer'在“范围”中?
I just stared making a new Core Data project but without making any changes yet, I am getting this error. Not sure why.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您已经命名了您的应用程序“ Coredata”,因此覆盖了框架的名称
coredata
,因此编译器所抱怨的是您的您的应用程序没有类型nspersistentContainer
。另外,您对导入语句(
导入coredata
)有警告,暗示某些问题是错误的解决方案:删除项目并创建一个具有更独特名称的新项目,甚至
mycoredapp
会做。You have named your application "CoreData" thus overwriting the name of the framework
CoreData
so what the compiler is complaining about is that your app doesn't have a typeNSPersistentContainer
.Also, you have a warning on the import statement (
import CoreData
) that hints that something is wrongSolution: Delete the project and create a new one with a more unique name, even something like
MyCoreDataApp
will do.