I am working on a iphone app and everything went fine untill I tried to import NSFetchedResultsController.h. when I was typing this Xcode completed it for me. But now it gives the error: NSFetchedResultsController.h file not found.
I included it like this:
#import "NSFetchedResultsController.h"
I looked all over the internet for the answer to this, but nothing works. (and a few things need Xcode 4.3 to work).
I am using Xcode 4.2 on Snow Leopard.
In fact you really don't need to import the header manually in most cases.
just add Coredata.framework to build phases as below:
Now look at left in project navigator, you see CoreData.framework added. open Header folder and simply you can find NSFetchedResultsController.h.
For testing its existence, you can type:
CoreData/NSFet
and voila, code suggestion tells you what you wanted . look at the picture below:
IMPORTANT: this is available only for iOS 3 or higher
"NSFetchedResultsController.h" is part of the CoreData framework, you have to
#import <CoreData/CoreData.h>
You also have to add the CoreData framework to the libraries that your app is linked with:
- Select your target in Xcode.
- Click on "Build Phases".
- In the "Link Binary With Libraries" section, click on "+" and add "CoreData.framework".
Sorry if this discussion is very basic for advanced programmers, but it may be useful for advanced programmers who have recently moved to Cocoa, or for beginners in Cocoa/Xcode. This may worth to have a look.
When you want to add a new header which is not included by default , you can first search google for that class reference in Apple Developer ( you can do that directly from your Xcode > Organizer ( at right top of Xcode window )
You should see a page like this:
Two most important things are : 1- Framework 2- Inherits From and
Then check the framework in your Build Phases> Link Binary With Libraries and add it if not exist.
By This , you should never encounter such a problem.
Check if the file is exist in the project folder, if yes, go to the project, select the app under targets section, go to build phases, open compile source then add the file NSFetchedResultsController.m
.