UIApplication delegates not working in class

Discussion in 'iOS Programming' started by bignumbers, Jul 15, 2008.

  1. bignumbers macrumors regular

    May 9, 2002
    I'm sure this is a newbie question.

    I have most of my code in my main view controller. Works fine.

    I'd like to be told when the app is launching, or when the iPhone is going to sleep.

    I can add this:
    - (void)applicationWillTerminate:(UIApplication *)application
    to my AppDelegate class, and that's fine. But my AppDelegate doesn't know the objects I want to deal with at shutdown.

    But I'd like to add it to my view controller class. If I type it in, it says it doesn't know what applicationWillTerminate means.

    Alternatively, I can catch it in the AppDelegate class, then call a instance method in my ViewController class. But I don't know how to do that either.

    So, some newbie help would be appreciated! Thank you!
  2. bignumbers thread starter macrumors regular

    May 9, 2002
    Whoops, never mind on this one too - figured that out.

    UtilityAppDelegate gets the notification. It sends a message to RootViewController, when then sends it off to MainViewController. Zowie!
  3. bessho macrumors newbie

    Apr 21, 2009

    I run into the same problem. Could you explain how you get it to work? in utility view? what are the key steps?

Share This Page