Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

appdelegate shared instance delegate

    MyAppDelegate *appD;        
    appD = [UIApplication sharedApplication];

    if(appD.sw1.on)
        NSLog(@"It is ON");
    else
        NSLog(@"It is OFF");

Gives no error while compiling. Runs without any warning, but it doesn't work.

I dont see what the problem is.

...

EDIT: OMG, should have called delegate method too:

appD = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
like image 894
erkanyildiz Avatar asked Jul 31 '26 06:07

erkanyildiz


1 Answers

I recommend you this method to share the app delegate: https://coderwall.com/p/z4h4uw?i=2&p=1&q=&t%5B%5D=%21%21mine&t%5B%5D=%21%21bookmarks

like image 164
Sergi Gracia Avatar answered Aug 02 '26 18:08

Sergi Gracia