Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4247040
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:03:16+00:00 2026-05-21T04:03:16+00:00

Before my application is going to be closed I have to logout user from

  • 0

Before my application is going to be closed I have to logout user from web service. And I can’t find the very last function that is invoked before application die?

-(void)LogoutUser
{    
    int userId = [[GlobalData sharedMySingleton] getUserId];

    NSString *soapMsg = 
    [NSString stringWithFormat:
     @"<?xml version=\"1.0\" encoding=\"utf-8\"?>...", userId
     ];

    NSURL *url = [NSURL URLWithString: @"http://....asmx"];     

    NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];    
    NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMsg length]];

    [req addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];   
    [req addValue:@"http://..." forHTTPHeaderField:@"SOAPAction"];  
    [req addValue:msgLength forHTTPHeaderField:@"Content-Length"];   
    [req setHTTPMethod:@"POST"];
    [req setHTTPBody: [soapMsg dataUsingEncoding:NSUTF8StringEncoding]];

    conn = [[NSURLConnection alloc] initWithRequest:req delegate:self];

    if (conn) 
    {
        webData = [[NSMutableData data] retain];
    }     

}

-(void) connection:(NSURLConnection *) connection didReceiveResponse:(NSURLResponse *) response 
{
    [webData setLength: 0];
}

-(void) connection:(NSURLConnection *) connection didReceiveData:(NSData *) data 
{
    [webData appendData:data];  
}

-(void) connection:(NSURLConnection *) connection didFailWithError:(NSError *) error 
{   
    [webData release];    
    [connection release];
}

-(void) connectionDidFinishLoading:(NSURLConnection *) connection 
{   
    NSString *theXML = [[NSString alloc] 
                        initWithBytes: [webData mutableBytes] 
                        length:[webData length] 
                        encoding:NSUTF8StringEncoding];    


    [theXML release];    

    [connection release];
    [webData release];   
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T04:03:17+00:00Added an answer on May 21, 2026 at 4:03 am

    There are two places you’ll need to trigger your logout code from, both of which are detailed in the UIApplicationDelegate Protocol Reference documentation.

    For pre-iOS 4 devices (and to cover other circumstances) you should use:

    - (void)applicationWillTerminate:(UIApplication *)application
    

    As Apple puts it:

    For applications that do not support
    background execution or are linked
    against iOS 3.x or earlier, this
    method is always called when the user
    quits the application. For
    applications that support background
    execution, this method is generally
    not called when the user quits the
    application because the application
    simply moves to the background in that
    case. However, this method may be
    called in situations where the
    application is running in the
    background (not suspended) and the
    system needs to terminate it for some
    reason.

    However, you’ll need to use…

    - (void)applicationDidEnterBackground:(UIApplication *)application
    

    …on iOS 4+ devices, as (once again from the Apple docs):

    In iOS 4.0 and later, this method is
    called instead of the
    applicationWillTerminate: method when
    the user quits an application that
    supports background execution

    That said, irrespective of all the above, you’ll most likely want to logout of the web service when your app is backgrounded and log back in when it’s “woken up” as well. See the above mentioned applicationDidEnterBackground: method and the applicationWillEnterForeground: method documentation for more details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to load some data from mysql into my cocoa application view before
Before I start developing a desktop application, I was wondering how large the installer
One thing I struggle with is planning an application's architecture before writing any code.
I've written a new application in a network I haven't worked in before, and
I am currently developing a Rails application using a database that was designed before
Before you answer this I have never developed anything popular enough to attain high
In my application I detect the out going call when a call is dialled
I also have a desktop application written in Windows Forms that is a middling
I'm hoping someone happens to have stumbled upon the following issue before. My Java
In your applications, what's a long time to keep a transaction open before committing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.