Possible Duplicate:
performSelector may cause a leak because its selector is unknown
I did a NSDictionary to convert my input(NSString) to selector. The "selector map" is looked as follows :
[self setCmdSelectorMap:[NSDictionary dictionaryWithObjectsAndKeys: [NSValue valueWithPointer:@selector(doOpenBrowserByString:)], @"openBrowser", [NSValue valueWithPointer:@selector(syncData:)], @"sync", [NSValue valueWithPointer:@selector(getCachedString:)], @"getCachedString", nil]];
When I try to fetch one of these selector and perform it by follows, it cause a warning :
sel = [[_cmdMap objectForKey:command] pointerValue]; NSLog(@"selector determined : %@", NSStringFromSelector(sel)); [self performSelector:sel withObject:arguments];
The warning says : PerformSelector may cause a leak because its selector is unknown. Is there any way to prevent this warning from occurring? or is there any "safer" way to perform such an action?
Thanks guys :)
Just use this:
#pragma clang diagnostic push #pragma clang diagnostic ignored "-Warc-performSelector-leaks" [self performSelector:sel withObject:arguments]; #pragma clang diagnostic pop
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With