Show alert when iphone is locked

Discussion in 'iOS Programming' started by pashik, Oct 24, 2008.

  1. pashik macrumors member

    Joined:
    Jul 16, 2008
    #1
    Hi.

    I have timer in application which shows UIAlertView and vibrates iphone.
    When iphone is locked iphone vibrates but alert is not shown at least after unlocking - alert is not visible.

    what is wrong and how to remain it visible?

    Code:
    	UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Warning" message:@"Alert"] delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
    	[alert show];
    	[alert release];
    
    thanx
     
  2. tacoman667 macrumors regular

    Joined:
    Mar 27, 2008
    #2
    You cannot have applications running in the background. They will end once you press the home button or flip to another application.
     
  3. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #3
    Neither of which has happened here. Locking the phone does not unload the current application.
     
  4. pashik thread starter macrumors member

    Joined:
    Jul 16, 2008
    #4
    exactly, as timer works fine when screen is locked

    but anyway i can't solve problem.
     
  5. tacoman667 macrumors regular

    Joined:
    Mar 27, 2008
    #5
    But does the phone suspend the running application when locked?
     
  6. pashik thread starter macrumors member

    Joined:
    Jul 16, 2008
    #6
    it seems it doesn't as timer still works and delegates are fired.
     
  7. tskoti macrumors newbie

    Joined:
    Nov 5, 2008
    #7
    how to show alert when HOme Button is Pressed

    hi,
    Plz tell me how to show an alert message when the Home button is pressed, saying Do u really want to close the application,


    Plz help, it is very urgent,

    Thanks in Advance,
    Koti
     
  8. jnic macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #8
    Take a look at applicationWillTerminate: in the UIApplicationDelegate protocol.
     

Share This Page