user7865437
user7865437

Reputation: 812

Why must I import my delegate header files?

I am always finding that if I create a delegate and then assign a class to conform to it I have to explicitly import the delegate .h file into that class otherwise I get an error stating the protocol cannot be found?

Am I missing a global setting somewhere that allows my project to find my delegate?

Thanks

Upvotes: 2

Views: 371

Answers (3)

Jesse Naugher
Jesse Naugher

Reputation: 9820

You can add it into your MyApp_Prefix.pch file if you want it to be added to every class's header. This obviously has some build performance issues, but other than that, shouldn't be a problem.

Upvotes: 1

Danail
Danail

Reputation: 10583

I think this is standard C stuff. You need to import your source file before using it. The delegate file is just another header file.

Upvotes: 0

Till
Till

Reputation: 27597

That is normal and expected. Otherwise that compiler would ALWAYS have to parse all headers prior to being able to compile code possibly totally unrelated to most header files.

Upvotes: 5

Related Questions