I added the Facebook sdk code to my project then I got this error because I already had a json library, so I deleted the Facebook json library from my computer and from the project but I still get this error. I search the whole project for "@interface SBJsonBase" and I only get one result. How can it say it's a duplicate when I only have one interface? Is it including the file twice? Does the search not always find everything?
-
NOTE: My question has not been answered yet, this was an unrelated tip.Thanks Darin, I never would have noticed that. – Curtis May 23 '12 at 17:34
-
Please refer to answer of [duplicate interface declaration for class 'test_coredataAppDeleg](http://stackoverflow.com/questions/5180232/duplicate-interface-declaration-for-class-test-coredataappdelegate). Some how you #import a header file twice. – Farooq Nasim Ahmad Sep 18 '12 at 08:04
5 Answers
May be this helps? Delete your derived data and do a clean project, then try to build again

- 2,083
- 2
- 16
- 16
-
I renamed the src folder to src2 and then re-added that folder to the project and it worked. But ya that probably would have worked too. – Curtis May 29 '12 at 07:07
I had a simular problem. It was a small search, but I could solve it without creating a new project etc... The thing was I had a Class B that was importing Class A. Then I had a class that imported Class B and also Class A. When I did this, these problems occured. Eg. A SOAP webservice Class imports all the Entities that are passed over the web.
Class goToSchoolWebservice.
import "person.h"
import "school.h"
...
Then I had a Singleton class used for caching that had the Logged in Person and also a ref to the webservice class.
import "person.h"
import "goToSchoolWebservice.h"
--> this is where is went wrong!! So watch out for these circular references. ITs not so easy to detect them!
if your using #include instead of import then use this technique to minimize duplicates: at the begining of your interface (actually right before it) do check for a definition and if not defined then define it and proceed to define your interface. here is an example:
#ifndef __NetworkOptionsViewController__H // check if this has every been imported before
#define __NetworkOptionsViewController__H
#import "blahblah.h"
@interface NetworkOptionsViewController : UITableViewController
{
NSMutableArray* somevariable1;
int somevariable2;
}
@end
#endif
-- for me personally, i got this error though because the file path to my class was wrong. I checked file inspector and my class file was not defined in Classes folder even though the IDE said it was. I deleted them and copied them over again.

- 60,549
- 65
- 286
- 456
For those that still get this error, despite following header import conventions: I got this error from importing a header that had been deleted from the project. The missing header was instead found in an old backup of my project in dropbox (That I made before doing some destructive stuff in Git), and that file caused the circular import.

- 61
- 1
- 6
I solved a similar problem by moving all the imports to the prefix header file.

- 1,049
- 5
- 15
- 29