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

  • Home
  • SEARCH
  • 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 6240025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:29:36+00:00 2026-05-24T11:29:36+00:00

I have the following 2 methods: -(void)authenticateUserToGoogle:(NSString *)userName withPassword:(NSString *)password { NSString *URLstr =

  • 0

I have the following 2 methods:

-(void)authenticateUserToGoogle:(NSString *)userName withPassword:(NSString *)password {


    NSString *URLstr = GOOGLE_CLIENT_LOGIN;
    URLstr = @"http://www.google.com/ig/api?stock=AAPL";
    NSURL *theURL = [NSURL URLWithString:URLstr];
    NSURLRequest *theRequest = [NSURLRequest requestWithURL:theURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:100.0];

    NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

    if (!theConnection) {
        NSLog(@"COuldn't register device information with Parking Server");
    } else {
        NSLog(@"Got a connection!!");
        NSMutableData       *_responseData = [NSMutableData data];
        NSLog(@"respone_data = %@",_responseData);

    }
    }

-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
    NSHTTPURLResponse *HTTPResponse = (NSHTTPURLResponse *)response;
    NSInteger statusCode = [HTTPResponse statusCode];

    if (404 == statusCode || 500 == statusCode) {
        //[self.controller setTitle:@"Error Getting Parking Spot ....."];
        [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:FALSE];
        NSLog(@"GOT A 'FUCKED' STATUS CODE");

        [connection cancel];
        NSLog(@"Server Error - %@", [NSHTTPURLResponse localizedStringForStatusCode:statusCode]);
    } else if (200 == statusCode) {
        NSLog(@"GOT A 'OK' RESPONSE CODE");

    }

}

If I call the authenticateUserToGoogle method as an instance method like this:

[self authenticateUserToGoogle:user withPassword:password]

I get the the following output:

2011-08-12 00:14:08.490 stcoks[81272:f203] Got a connection!!
2011-08-12 00:14:08.492 stcoks[81272:f203] respone_data = <>
2011-08-12 00:14:08.726 stcoks[81272:f203] GOT A 'OK' RESPONSE CODE

However, if I change the authenticateUserToGoogle method to be a class method by simply changed the “-” to “+” in the method signature and then call it like this:

[MasterViewController authenticateUserToGoogle:user withPassword:password]

I get the following output:

2011-08-12 00:14:08.490 stcoks[81272:f203] Got a connection!!
2011-08-12 00:14:08.492 stcoks[81272:f203] respone_data = <>

In other words it seems like the with the class method, the delegate method connection didReceiveResponse never gets called!!

Can anyone explain this behavior to me? Thanks!

  • 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-24T11:29:37+00:00Added an answer on May 24, 2026 at 11:29 am

    When you start the NSURLConnection with delegate:self, that sets up the delegate object which will receive the connection:didReceiveResponse: message. If you use self within a class method, this method will also be called as a class method.

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

Sidebar

Related Questions

Scenario I have the following methods: public void AddItemSecurity(int itemId, int[] userIds) public int[]
I have the following methods: protected static void updateExistingSection(XmlDocument doc, XmlNode rootNode, string sectionTag,
Say I have the following methods: public static void MyCoolMethod(params object[] allObjects) { }
I have the following two archiving methods: - (void) encodeWithCoder: (NSCoder *) encoder {
I have the following ADBannerViewDelegate implementations: #pragma mark ADBannerViewDelegate Methods - (void)bannerViewDidLoadAd:(ADBannerView *)banner {
I have the following methods: void s<t>(int a, t b) { ... .. .
Imagine that I have the following two methods: void AddEvenNumbers() { for(int i=0; i<10000000;
I have the following method: public void PutFile(string ID, Stream content) { try {
I have the following method public static void SerializeToXMLFile(Object obj,Type type, string fileName) {
I have the following C++ method : __declspec(dllexport) void __stdcall getDoubles(int *count, double **values);

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.