I am working on an old app and I am converting its memory handling to ARC (automatic reference counting) and in one of my classes I got this warning: PerformSelector may cause a leak because its selector is unknown. I researched this problem and came upon this great find as explained by wbyoung. To mitigate my warning I changed my original code from:
- (void)launchExecution {
    @autoreleasepool {
    // Start executing the requested task
        [targetForExecution performSelector:methodForExecution withObject:objectForExecution]; //--WARNING happens here...
        // Task completed, update view in main thread (note: view operations should
        // be done only in the main thread)
        [self performSelectorOnMainThread:@selector(cleanUp) withObject:nil waitUntilDone:NO];      
    }
}
and I modified it to:
- (void)launchExecution {
    @autoreleasepool {
        if(!targetForExecution) return;
        SEL selector = methodForExecution;
        IMP imp = [targetForExecution methodForSelector:selector];
        void (*func)(id, SEL) = (void *)imp;
        func(targetForExecution, selector);
        // Task completed, update view in main thread (note: view operations should
        // be done only in the main thread)
        [self performSelectorOnMainThread:@selector(cleanUp) withObject:nil waitUntilDone:NO];
    }
}
Now my issue is this: while it doesn't give me any errors (yay!), I still have to pass along my ObjectForExecution value into this new configuration. How is this done? I know there are some workarounds where people have used pragma to ignore this type of warning but I would like to properly fix this warning.
 
     
    