It is primarily a warning message, and there is no such warning in a non-ARC project. If you modify it in one place, you only need to add the following code:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-warc-performselector-leaks"
[Self.tickettarget performSelector:self.ticketAction withobject:self];//here is where you call the function
#pragma clang diagnostic pop
If you use multiple places in your program, you can write a macro definition, as follows:
#define SUPPRESSPERFORMSELECTORLEAKWARNING (Stuff) \
do {\
_pragma ("clang diagnostic push") \
_pragma ("clang diagnostic ignored \"-warc-performselector-leaks\ "") \
Stuff; \
_pragma ("clang diagnostic pop") \
} while (0)
If no result is returned, it can be called directly as follows:
Suppressperformselectorleakwarning (
[_target performselector:_action Withobject:self]
);
If you want to return a result, you can call it as follows:
ID result;
Suppressperformselectorleakwarning (
result = [_target performselector:_action withobject:self]
);
More iOS Madness: Http://blog.csdn.net/wanglongblog
iOS Madness warning:performselector may cause a leak because it selector is unknown