performSelector may cause a leak because its selector is unknown
2013-12-28 14:41
399 查看
from:http://stackoverflow.com/questions/7017281/performselector-may-cause-a-leak-because-its-selector-is-unknown
第一种解决办法:
As a workaround until the compiler allows overriding the warning, you can use the runtime
instead of
You'll have to
第二种:
To ignore the error only in the file with the perform selector, add a #pragma as follows:
第三种:
第一种解决办法:
As a workaround until the compiler allows overriding the warning, you can use the runtime
objc_msgSend(_controller, NSSelectorFromString(@"someMethod"));
instead of
[_controller performSelector:NSSelectorFromString(@"someMethod")];
You'll have to
#import <objc/message.h>
第二种:
To ignore the error only in the file with the perform selector, add a #pragma as follows:
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
第三种:
#define SUPPRESS_PERFORM_SELECTOR_LEAK_WARNING(code) \ _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \ code; \ _Pragma("clang diagnostic pop") \ SUPPRESS_PERFORM_SELECTOR_LEAK_WARNING( return [_target performSelector:_action withObject:self] );
相关文章推荐
- warning:performSelector may cause a leak because its selector is unknown
- iOS PerformSelector may cause a leak because its selector is unknown
- objective-c "performSelector may cause a leak because its selector is unknown".
- "performSelector may cause a leak because its selector is unknown"警告原因及其解决办法
- 如何解决使用ARC后出现的PerformSelector may cause a leak because its selector is unknown
- performSelector may cause a leak because its selector is unknown
- 如何解决使用ARC后出现的PerformSelector may cause a leak because its selector is unknown
- performSelector may cause a leak because its selector is unknown
- 如何解决使用ARC后出现的PerformSelector may cause a leak because its selector is unknown
- 如何解决使用ARC后出现的PerformSelector may cause a leak because its selector is unknown
- performSelector may cause a leak because its selector is unknown
- performSelector may cause a leak because its selector is unknown解决
- performSelector may cause a leak because its selector is unknown
- 消除warning:PerformSelector may cause a leak because its selector is unknown
- PerformSelector may cause a leak because its selector is unknown
- performSelector may cause a leak because its selector is unknown
- warning:performSelector may cause a leak because its selector is unknown
- warning:performSelector may cause a leak because its selector is unknown
- PerformSelector may cause a leak because its selector is unknown
- iOS开发--"performSelector may cause a leak because its selector is unknown"警告原因及其解决办法