Suspending App?

Discussion in 'iOS Development' started by allbrokeup, Oct 6, 2008.

  1. allbrokeup

    allbrokeup New Member

    Joined:
    Mar 7, 2008
    Messages:
    51
    Likes Received:
    0
    Hey all,

    You know when you get a phone call on your iPhone (ESPECIALLY in Safari

    Please Register or Log in to view images

    ) and it suspends the current app and switches to the Lock Screeny thing and asks you to answer or clank it in their ear? Well, I need the code to do that, because I cannot how to save my application state. (Keep in mind it has multiple XIB's and Multiple Views with their source files. And it cannot rotate according to Interface Orientation for some ridiculous reason.) What I want to do, is have it on permanent suspension, it never terminates, so when I have it open, And press the Home Button, it suspends and returns to SpringBoard, and restores the state when I re-open it.

    Please Register or Log in to view images

    Please Register or Log in to view images

    (is this possible??)

    If anyone can give me the code, it would be great, but if anyone could help me with a simpler (tutorial on saving app

    Please Register or Log in to view images

    Please Register or Log in to view images

    ) way, it would be even betterer!

    Please Register or Log in to view images

  2. cocotutch

    cocotutch Community Development Team Staff Member

    Joined:
    Oct 6, 2008
    Messages:
    1,285
    Likes Received:
    117
    Device:
    5G iPod touch
    i think that i have seen that code somewhere on the internet before. not sure where, but ill have a looksee and post back if i find.
  3. gojohnnyboi

    gojohnnyboi Well-Known Member

    Joined:
    Jan 25, 2008
    Messages:
    3,339
    Likes Received:
    55
    place this code in your application delegate class

    Code:
    - (void)applicationSuspend:(struct __GSEvent *)suspensionEvent {
            // You can also do what you wish on suspension here
    }
    that's how i think i did it. It may no longer work though on 2.1
  4. God__

    God__ New Member

    Joined:
    Dec 23, 2007
    Messages:
    69
    Likes Received:
    0
    1. Take fish hook, large.
    2. Tie a string to that hook.
    3. Tie that hook to a tree.
    4. Stab your phone with the hook.
    5. Start your app.
    6. Let go of your phone.

    Alternatively you can override any of these methods:
    Code:
    - (void)applicationWillSuspend;
    - (void)applicationWillSuspendForEventsOnly;
    - (void)applicationWillSuspendUnderLock;
    Don't forget to compliment your suspension with a desuspension.
    Code:
    - (void)applicationDidResume;
    - (void)applicationDidResumeForEventsOnly;
    - (void)applicationDidResumeFromUnderLock;
    Want to actually close your app?
    Code:
    - (void)applicationWillTerminate;
    Want to close your app with style?
    Code:
    - (BOOL)applicationWillJoinSkynetAndPrepareForJudgementDayAndTheTerminationOf:(NSMutableArray *)manKind;

Share This Page