iOS Madness warning:performselector may cause a leak because it selector is unknown

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.