title: How do you execute a method at application start in xcode?
body: <p>I'm an Xcode newbie, and I know it's kind of a stupid question, however I haven't found anything on the matter (maybe wrong search parameters).</p>
  
  <p>Anyway, here's the problem: How do you run a method at application start/end?  </p>
  
  <p>Details: I'm making a flashlight app with a button that turns the LED on/off and changes the title of the button("Turn flash on"/"Turn flash off");</p>
  
  <p>Everything is ok, but when I exit the app(home button) while the flash is on and run the app again, it keeps the settings from the last run(button title is "Turn flash off" and the ison BOOL stays YES);</p>
  
  <p>So, how do I fix that?<br>
  I tried making a method <code>'changetitle: (NSString *)text'</code> and placing it in <code>'dealloc'</code>,  <code>'viewDidLoad'</code>,<code>'viewDidUnload'</code> but they only work when app has a 'fresh' run (closed from multitasking = twice home button and quit there), so it's useless.<br>
  Do I need to call the method from main? It seems unnecessary. </p>