objective c - How to check for API availability in XCode 9 -
i'm using usernotification
framework available in ios 10. declaring method uses framework , far, have been doing check availability follows:
@interface myservice : nsobject #if __iphone_os_version_max_allowed >= 100000 -(bool)handlewillpresentnotification:(unnotificationcontent *)notificationcontent; #endif @end
xcode 9 beta release , code warning
'unnotificationcontent' partial: introduced in ios 10.0 annotate 'handlewillpresentnotification:withcompletionhandler:' availability attribute silence
the question how annotate in objective c code entire method? know xcode 9 introduced
if (@available(ios 10, *)) { // ios 10 objc code }
but how wrap entire method (including signature) in it?
cheers
to answer own question: need mark method using ns_available_ios
macro follows:
-(bool)handlewillpresentnotification:(unnotificationcontent *)notificationcontent ns_available_ios(10_0);
Comments
Post a Comment