Suppressing “'…' is deprecated” when using respondsToSelector

后端 未结 5 595
野的像风
野的像风 2020-12-04 17:36

I\'m supporting 10.4+ by picking the most-current API at runtime:

if ([fileManager respondsToSelector:@selector(removeItemAtPath:error:)])
    [fileManager r         


        
5条回答
  •  既然无缘
    2020-12-04 18:01

    You could declare a separate file that is designated for calling deprecated methods and set the per-file compiler flags in Xcode to ignore -Wdeprecated-declarations. You can then define a dummy function in that file to call the deprecated methods, and thereby avoid the warnings in your real source files.

提交回复
热议问题