Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
120 views
in Technique[技术] by (71.8m points)

How do I flag a function as being deprecated in an iOS Objective-C header file?

How do I flag a function as being deprecated in an iOS Objective-C header file?

I'm guessing there's just some keyword I can stick after the function somewhere?

I would like for a compiler warning to be generated should anyone try and use the deprecated function, similar to the behavior seen in Apple's APIs.

question from:https://stackoverflow.com/questions/1443599/how-do-i-flag-a-function-as-being-deprecated-in-an-ios-objective-c-header-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try appending an attribute to your method declaration:

- (void)fooBar __attribute__ ((deprecated));

Taken from here.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...