0

I have a new project which has core data enabled in swift. But when I load the project there is an error message in the app-delegate file saying

"cannot load module 'Coredata' as 'CoreData' ". I have attached a screenshot of my appdelegate.swift for easy understandability of the error.

I checked doing core data in objective c and its working fine but why is it having problems in Swift?

I have tried out all possible means. I have deleted the whole project and did a new one but still the problem persists. I don't know what to do. Any project in swift in which I enable coredata has the same problem. I also reinstalled the XCode and replaced the old ome by a new one but the problem is still there.

  • 1
    Does "Coredata" with that exact capitalization exist anywhere in your project? – Phillip Mills Nov 30 '15 at 13:19
  • @PhillipMills I can't get you. –  Nov 30 '15 at 13:21
  • @PhillipMills Please help. It is not the case of a single project. Any swift project I am creating enabling CoreData it shows the same problem everywhere. –  Nov 30 '15 at 14:10

3 Answers3

1

In the error message it states that there seems to to be a module called "Coredata" (with the 5th letter not capitalized). This implies, as Phil points out, that somewhere in your project you have a reference to a module that has exactly this strange spelling.

Best try to create a project and not call it "Coredata" but something more distinct, such as "CDTest" or so.

Also you should first try to make it work in pure Swift without using and Objective-C. I recommend rewriting the Student classes in Swift anyway.

If you insist on mixing Objective-C and Swift, I would guess the error is in your bridging header. Perhaps you did not follow the right procedure when adding your Objective-C files.

Mundi
  • 79,884
  • 17
  • 117
  • 140
  • I have tried out all possible means. I have deleted the whole project and did a new one but still the problem persists. I don't know what to do. Any project in swift in which I enable coredata has the same problem. I also reinstalled the XCode and replaced the old ome by a new one but the problem is still there. –  Dec 01 '15 at 01:14
0

I figured it out that there was some old file which was named as Coredata which was present deep inside the cache of XCode and I needed to clear that. So I went through the cache cleaning process mentioned in the question- How to Empty Caches and Clean All Targets Xcode 4

Community
  • 1
  • 1
0

appdelicate.swift is the part of coredata so there is no need to import it again...

screen shots

Draken
  • 3,134
  • 13
  • 34
  • 54