cschwarz
cschwarz

Reputation: 1205

How to use compiler #warning in my code?

I am writing a larger project and am trying to make a deprecated method "print" a #warning about the deprecation when the method is called.

How could I do so? Just again: I have this

#warning -methodname:(id)sender is deprecated, use ...

I only want this message appear in the build warnings, if the message is called, not all the time.

Upvotes: 1

Views: 121

Answers (1)

Jonathan Grynspan
Jonathan Grynspan

Reputation: 43472

Place this after the declaration of the method, before the semicolon: __attribute__((__deprecated__))

Upvotes: 1

Related Questions