Call AppDelegate Method from Class
Posted
by golfromeo
on Stack Overflow
See other posts from Stack Overflow
or by golfromeo
Published on 2010-06-12T14:44:08Z
Indexed on
2010/06/12
14:53 UTC
Read the original article
Hit count: 221
Basically, I need to call a method in my AppDelegate from one of my view controller classes.
Currently, I'm doing the following:
myAppDelegate *appDelegate = (myAppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate doMethod];
And including the myAppDelegate.h at the top of the .m file of the class:
#import "myAppDelegate.h"
When I run it, everything works...
But I get the following warning:
warning 'myAppDelegate' may not respond to '-doMethod'
Is there another way that I should reference the app delegate?
Thanks for any help in advance.
© Stack Overflow or respective owner