I seem to be losing static typing ability when defining,
#define myAppDelegate (WorkClockAppDelegate *) [[UIApplication sharedApplication] delegate]
To do this,
[myAppDelegate doSomething];
Xcode doesn’t know what doSomething is, although it will compile and run fine as long as I know what I’m doing, and doSomething actually exists on myAppDelegate!
Is there any way I can overcome this?
You don’t lose it, no — you are probably omitting an
#import, or the order of#imports may be wrong.Just use a function:
or a method:
to introduce type safety.
although you could use an
externvariable, that’s not very safe.using
#defineis not a good solution, imo.