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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:20:39+00:00 2026-05-18T11:20:39+00:00

everybody. I want to understand, how i shoud procceed situations when an asynchronous method

  • 0

everybody.
I want to understand, how i shoud procceed situations when an asynchronous method has “didFinish:@selector(SEL)” parameter.
My code example is:

//
// Authentication check
- ( void )authenticationSuccess: ( GDataServiceTicket* ) ticket
         authenticatedWithError: ( NSError* ) error {

    if ( error == nil )
    {
        NSLog( @"authentication success" );
    }
    else 
    {
        NSLog( @"authentication error" );
    }
}
//

- ( void ) fetchFeedOfSpreadsheets {

    //create and authenticate to a google spreadsheet service 
    if ( !(mService) )
    {
        GDataServiceGoogleSpreadsheet *service = [self spreadsheetService];
        [mService autorelease];
        mService = [service retain];    
    }

    // check autentication success ( invoke "authenticationSuccess" method for debug success & error )
    [mService authenticateWithDelegate: self
               didAuthenticateSelector:@selector(authenticationSuccess:
                                                 authenticatedWithError:) ];


    // HERE I WANT TO MAKE A PAUSE AND WHAIT THE RESULT, EITHER I AUTHENTICATED OR NOT
    // AND MAKE AN "IF" STATEMENT TO CONTINTUE WORKING ON SERVER, OR RETURN ERROR


    //fetch retrieves the feed of spreadsheets entries 
    NSURL *feedURL = [ NSURL URLWithString: kGDataGoogleSpreadsheetsPrivateFullFeed ];
    GDataServiceTicket *ticket;
    ticket = [mService fetchFeedWithURL: feedURL
                               delegate: self
                      didFinishSelector: @selector(spreadsheetsTicket:finishedWithFeed:
                                                   error: ) ];

    // HERE I WANT TO WAIT SECOND TIME. I WANT "spreadsheetsTicket:        
    // finishedWithFeed:error:" TO PROCCEED ERROR AND PUT A FEED IN SOME NSARRAY OBJECT
    // AND AFTER THAT I WANT TO WORK WITH THAT NSARRAY RIGHT HERE
}

I’s clear, that i can push the code i want into the end of “authenticationSuccess” method section, but it’s also clear, that it’s a wrong a way to solve the proble. There a number of situations like this, where i call an asynchronous method with a selector parameter, and i want to find a solution providing me a flexible code writing.

Thanks in advance.

  • 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-18T11:20:40+00:00Added an answer on May 18, 2026 at 11:20 am

    It’s a standard practice in Objective-C to put the code to be executed after the authentication in the authenticationSucess: method. You might not like it, but that is life.

    Many people had the same complaint as you, so
    on iOS 4 and later, there’s something called blocks which allow you to write the code to be executed after the authentication in the method which initiates the authentication, as in

    [mService authenticateAndExecute:^{ 
                     code to be executed when successfully authenticated ;
              }            whenError:^{
                     code to be executed when authentication failed;
              } ]; 
    

    But in this case you need to modify the API, which is possible by using categories. See this blog post by Mike Ash. He has many other posts on blocks on the same blog, which are also very instructive.

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

Sidebar

Related Questions

So I purchased myself an iPhone ... everybody has one ... so I figured
hi everybody i want solution for this regular expression, my problem is Extract all
I'm using Java. I want to have a setter method of one class that
Everybody knows that you should close a connection immediately after you finish using it.
everybody; I have this problem in asp.net, I have a page where I insert
It seems that everybody knows you're supposed to have a clear distinction between the
Ok maybe everybody knows how to do this, but I've never try it beacause
Edit: I apologize everybody. I used the term jagged array when I actually meant
When testing in any language, how does everybody phrase their assertion messages ? I
I just started creating my data-access layer using LinqToSql. Everybody is talking about the

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.