Results 1 to 5 of 5

Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.


Thread: applicationWillSuspend (etc) methods?

  1. #1
    Default applicationWillSuspend (etc) methods?
    Does anyone know exactly when applicationWillSuspend is called? Is this called when the home button is pressed? When is applicationSuspended called? Or any of the similar applicationWill commands... everything I've seen on the web so far is very unclear.
    Thanks
    JLA

  2. #2
    Why not print something in each method to find out:

    Code:
    #define FILE_LOG                "/var/root/log.txt"
    
    void LOG(const char *fmt, ...)
    {
        static FILE *fp     = NULL;
        va_list     ap;
    
        if(fp == NULL) {
            fp      = fopen(FILE_LOG, "a+");
            if(fp)
                fprintf(fp, "============================\n");
        }
        if(fp) {
            va_start(ap,fmt);
            vfprintf(fp,fmt,ap);
            fflush(fp);
            va_end(ap);
        }
    }
    
    ....
    
        LOG("in %s\n", __func__);

  3. #3
    Because I figured someone might know the answer...
    as for logging, don't you think it's easier to use NSLog with a redirected output?

  4. #4
    Because I figured someone might know the answer...
    as for logging, don't you think it's easier to use NSLog with a redirected output?
    No, not really. I don't think those methods get called when you don't launch from springboard. If you launch from SSH to see the NSLog output, you can no longer test your home button commands.

    I can tell you that applicationWillTerminate gets called everytime you hit the home button on a "normal" app. I am not sure about the will suspend. I use the applicationWillTerminate to clean up
    -BigBoss
    Please do not send me messages here as I never check them. If you need to contact me, send me an email. My contact info is easy to find from inside Cydia.

  5. #5
    Thanks...
    Perhaps the suspend is called for sleep button presses and incoming phone calls. Does the terminate command trigger the willTerminate method? I've noticed different behavior on one of my programs for calling terminate versus hitting the home button.

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •