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

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -