Strange behavior accessing appdelegate script

Hi All,
Hi have an ASOC app with ObjC class methods and have used this to call methods from the delegate script. Has always worked fine.

[[NSApp delegate] backupNow:theSet];

Suddenly I added call to another delegate’s method

[[NSApp delegate] doSomething:someString];

and it won’t compile - I get "No known instance method for selector “doSomething”

What’s up? All the old method calls are ok but I can’t add a new one. I tried in Xcode 5.2, 5.0 etc but all the same. I am on OS 10.9.2

Any thoughts - maybe I am missing something obvious.

Thanks, Rob

Hi,

you’re talking about “class methods” (starting with + in ObjC) but the error message says no “instance method” (starting with - in ObjC)

Hi Stefan,

I meant I have an ASOC app with with Objc classes ( not “class methods”)

I am calling a method in the applescript class (no distinction there unless I missed something) from ObjC class.

I have done this many times - it works - but now it won’t work if I add a new call to another method (not already compiled.)

Rob

On the ObjC side you need to declare the method in an interface or informal protocol.
There must be similar declarations for the other methods

AH!

It’s been a while since I did this and I completely overlooked that (which I had of course done before…)

@interface BLTimer (applescriptMethods)

-(void)backupNow:(NSString*)theSet;
-(void)reloadMenuNow:(NSString*)theSet;  //(now it works. Doh!)

@end

Thanks Stefan,

Rob