The only thing I found to avoid the warning was to suppress it. You can disable it in the build settings, but I prefer to just use pragmas to disable it, where I know it is false.
# pragma clang diagnostic push # pragma clang diagnostic ignored "-Warc-performSelector-leaks" [_target performSelector:_action withObject:self]; # pragma clang diagnostic pop
If you get an error in several places, you can define a macro to make it easier to suppress the warning:
#define SuppressPerformSelectorLeakWarning(Stuff) \ do { \ _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \ Stuff; \ _Pragma("clang diagnostic pop") \ } while (0)
You can use the macro as follows:
SuppressPerformSelectorLeakWarning([_target performSelector:_action withObject:self]);
rob mayoff Aug 10 2018-12-12T00: 00Z
source share