I think you understand why the warning is coming up.

But I would suggest this is a factorisation too far. Do you need to employ this 
(to my eyes, rather strange) form of code so often that it is necessary to 
factor out the selector in/out code in the way you have? Why not just move the 
performSelector calls directly into your loop (or better still, invoke the 
methods directly). The code will be ultimately a lot more readable, not only by 
the compiler, but by you, as well as having much higher performance. If you 
need to employ the same patter elsewhere, duplicate the loop rather than factor 
out the inefficient common part.


--Graham


On 16/10/2011, at 6:23 PM, Gerriet M. Denkmann wrote:

> - (void)replaceIn: thing  readSelector: (SEL)selectorIn  writeSelector: 
> (SEL)selectorOut  withTable: (NSString *)tableName;
> {
>       NSString *key = [ thing performSelector: selectorIn ];
>       ...
>       NSString *rep = ...
>       [ thing performSelector: selectorOut withObject: rep ];
> }
> 
> Now, using Arc I am told that  "PerformSelector may cause a leak because its 
> selector is unknown".
> What I am supposed to do about this? I really want to have code without 
> warnings.
> 
> 
> Update:
> I guess Arc has no way to know, whether "selectorIn" is something like 
> "copy". 
> So I am quite willing to reassure it that "selectorIn" is always something 
> like title, stringValue, toolTip, etc. 
> I think I should declare the SEL as __attribute__((ns_returns_not_retained)).
> 
> But how exactly? There really should be some examples.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to