views:

67

answers:

1

I have not found any answer to why I cannot add a data model to an existing project. So given the fact that creating a project from scratch using core data for storage does create the data model correctly I am trying to move the entire project into a new project that contains the data model.

No matter how I try to do it at some point it will the new project will not build. In my first attempt I tried just dragging an dropping from one to the other, clean all targets and build... disastrous.

After trying several different approaches, the closest I came to success was as follows...

  1. created the new project (same name as my existing project)

  2. link the necessary frameworks

  3. copy the resources, ie plists, icons, picts

  4. create all the classes in the new project

  5. copy the contents of each .f & .m files of each class that does not reference any other class. For each class delete the .xib file and copy the .xib file from the existing project, clean all targets, check all links in the .xib, build.

  6. work my way through the remaining classes as in step 5 making sure that any referenced classes are always created first.

Following this methodology I get to my last 2 classes and get a symbol(s) not found error on a reference back to one of the first classes I created. This error as far as I can tell has something to do with not having a framework properly linked, but I can't figure out how to fix it.

Is there a better way to do this.

I have a tech request in to apple on my data model problem, but can't afford to sit around and wait for their response.

Thanks for any help.

John

+1  A: 

You should add the Core Data framework to your project as well as adding the following:

#import <CoreData/CoreData.h>

to your Prefix.pch file. However since you have not said what happened other than "disastrous" it is hard to give you a more targeted answer.

Marcus S. Zarra
Yes the Core Data framework was added. Being as I created the new project as windows based project with Core Data for data storage I would have thought the import statement would have been put someplace, but it was not in the prefix.pch file or anyplace else. There were so many errors, I couldn't list them. I am going to try and do it again with the simple drag and drop, and maybe report back with the results. Thanks for trying to help.John
If you don't create it from a template then Xcode will *NOT* add any imports for any frameworks. If you want that feature in Xcode then I would highly recommend filing a radar so that you can let Apple know.
Marcus S. Zarra
OK, I created the new project and drag and dropped all my classes and resources over. I cleaned all targets and built as I went through each class. This time I was able to complete it all and successfully build the new project. Unfortunately the view being called by my AppDelegate on applicationDidFinishLaunching shows up blank. The code is running fine but the view is blank. The xib looks fine with all the links intact.Not sure where to go from here.John
That is difficult to diagnose without any code. Something is not linked up correctly somewhere either in code or in the nib. Is the app delegate named the same? Are you seeing any warnings? What does the static analyzer say?
Marcus S. Zarra
Agreed, too difficult. Everything is the same as the original database. Build and Analyze reports no problems. No warnings. I really do not have time to pursue trying to duplicate the project.Thnaks for your help, but I am moving ahead with other aspects of the app and hopefully Apple will get back to me with some explanation and a fix as why I cannot add a data model to the project.Johhn