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 6556025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:53:29+00:00 2026-05-25T12:53:29+00:00

When i press login in my app, it logs in twice in API instead

  • 0

When i press login in my app, it logs in twice in API instead of just once.., there is something wrong with this but i cant find what, because it just execute this code once.

   NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];     
    NSHTTPURLResponse   * response;
                NSError             * error;
                NSMutableURLRequest * request;
                NSString            * params;
                NSString *urlAddress = [NSString stringWithFormat:@"%@/?action=request&api=json&module=ManagementModule&function=startSession&instance=0",[ConnectServer returnserverip]];
                NSLog(@"UPX %@",[ConnectServer returnserverip]);
                NSLog(@"IP %@",[ConnectServer returnclientip]);
                if([defaults boolForKey:@"enablePincode"]){
                    NSString *account = [defaults stringForKey:@"myAccount"];
                    NSString *username =[defaults stringForKey:@"myUsername"];
                    NSString *password = [defaults stringForKey:@"myPassword"];
                    NSString *clientip = [ConnectServer returnclientip];
                    NSString *clientname = [ConnectServer returnclientname];
                    params = [[[NSString alloc] initWithFormat:@"params=&auth[password]=%@&auth[mode]=%@&auth[account]=%@&auth[user]=%@&auth[rights]=%@&auth[user_ip]=%@&auth[client_name]=%@",password,@"password",account,username,@"user",clientip,clientname] autorelease];
                }
                else {
                    NSString *clientip = [ConnectServer returnclientip];
                    NSString *clientname = [ConnectServer returnclientname];
                    params = [[[NSString alloc] initWithFormat:@"params=&auth[password]=%@&auth[mode]=%@&auth[account]=%@&auth[user]=%@&auth[rights]=%@&auth[user_ip]=%@&auth[client_name]=%@",[myPassword text],@"password",[myAccount text],[myUsername text],@"user",clientip,clientname] autorelease];
                }
                request = [[[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlAddress] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:60] autorelease];
                NSData *myRequestData = [params dataUsingEncoding:NSUTF8StringEncoding];
                [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:[[NSURL URLWithString: urlAddress] host]];
                [request setHTTPMethod:@"POST"];
                [request setHTTPBody:myRequestData];
                [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Accept"];
                [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
                [request setValue:[NSString stringWithFormat:@"%d", [myRequestData length]] forHTTPHeaderField:@"Content-Length"];
                [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; 
     NSLog(@"RESPONSE HEADERS: \n%@", [response allHeaderFields]);
    request.URL = [NSURL URLWithString:urlAddress];
    error       = nil;
    response    = nil;
    NSData * data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
    NSLog(@"The server saw:\n%@", [[[NSString alloc] initWithData:data encoding: NSASCIIStringEncoding] autorelease]);
    NSLog(@"Parameters: %@", params);
    NSLog(@"Actual sended parameters to the server: %@", myRequestData);
    NSString *Sresponse;
    Sresponse = [[[NSString alloc] initWithData:data encoding: NSASCIIStringEncoding] autorelease];
  • 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-25T12:53:30+00:00Added an answer on May 25, 2026 at 12:53 pm

    There are two requests in the code:

    [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; 
    

    and five lines down

    NSData * data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
    

    Hint: In cases like this use wireshark or my favorite Charles which will decode SSL connections.

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

Sidebar

Related Questions

In Facebook API...FBConnect...I have used API Key and App Secret...but when I login to
When I press F5, everything compiles fine, but when the app is to be
in this app, the user logs in and their credentials are checked against a
In my app, the user logs in with a custom made login dialog. The
when I press the Maximize button on my WPF app, all the controls therein
So I just got my first django app deployed. I did a syncdb and
I have seen this question floating around the internet, but I haven't found a
I have a Mobile App (iPhone and Android) which allows user to login to
UPDATE: I've build a WPF app with no code behind, just put in a
When using the facebook login API, when you click the login button, it opens

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.