Great catch! And it just so happens this pitfall is mentioned in Mike Ash's 
latest Friday Q&A:

<http://mikeash.com/pyblog/friday-qa-2012-12-14-objective-c-pitfalls.html>

("Missing Method Argument")

--Andy

On Dec 18, 2012, at 11:46 AM, BlueBoy <[email protected]> wrote:

> You're missing the first argument name in the protocol method...
> 
> - (void)tokenControl:(RPTokenControl*) <missingArgument>
>        renameToken:(NSString*)token ;
> 
> 
> 
> 
> 
> On 18 Dec 2012, at 14:31, Jerry Krinock wrote:
> 
>> I am so stumped as to why llvm cannot see the declaration of a method in a 
>> protocol that I have reproduced the issue in a small test project.  An error 
>> or warning occurs in the last line of the following code, where I send the 
>> message to a delegate which is declared to implement the protocol.
>> 
>> If ARC is on, I get this the error:
>> No visible @interface for 'NSObject<RPTokenControlDelegate>' declares the 
>> selector 'tokenControl:renameToken:'
>> 
>> If ARC is off, it instead appears as a warning:
>> Instance method '-tokenControl:renameToken:' not found (return type defaults 
>> to 'id')
>> 
>> In my real project, which is non-ARC, if I ignore the warning, the code runs 
>> OK.
>> 
>> Thank you for answering what must be a simple question.
>> 
>> Jerry Krinock
>> D
>> *******  JunkLib.h **********************************************
>> 
>> #import <Foundation/Foundation.h>
>> 
>> @protocol RPTokenControlDelegate ;
>> 
>> @interface RPTokenControl : NSObject {
>>   NSObject <RPTokenControlDelegate> * m_delegate ;
>> }
>> 
>> @property (assign) NSObject <RPTokenControlDelegate> * delegate ;
>> 
>> @end
>> 
>> 
>> *******  JunkLib.m **********************************************
>> 
>> #import "JunkLib.h"
>> 
>> @protocol RPTokenControlDelegate
>> 
>> - (void)tokenControl:(RPTokenControl*)
>>        renameToken:(NSString*)token ;
>> 
>> @end
>> 
>> @implementation RPTokenControl
>> 
>> - (IBAction)renameSelectedToken:(NSMenuItem*)sender {
>>   [[self delegate] tokenControl:self
>>                     renameToken:@"junk"] ;  // ERROR!!
>> }
>> 
>> @end
>> 
>> 
>> _______________________________________________
>> 
>> Cocoa-dev mailing list ([email protected])
>> 
>> 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:
>> https://lists.apple.com/mailman/options/cocoa-dev/blue.buconero%40virgin.net
>> 
>> This email sent to [email protected]
> 
> 
> _______________________________________________
> 
> Cocoa-dev mailing list ([email protected])
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com
> 
> This email sent to [email protected]

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to