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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:43:13+00:00 2026-05-15T03:43:13+00:00

I have an app that uploads to Google Spreadsheets via the GData ObjC client

  • 0

I have an app that uploads to Google Spreadsheets via the GData ObjC client for Mac/iPhone. It works fine as is. I’m trying to get the upload portion on its own thread and I’m attempting to call the upload method on a new thread.

Look:

-(void)establishNewThreadToUpload {
    [NSThread detachNewThreadSelector:@selector(uploadToGoogle) toTarget:self withObject:nil];
}

-(void)uploadToGoogle {
    NSAutoReleasePool *pool = [[NSAutoReleasePool alloc] init];
    //works fine
    [helper setNewServiceWithName:username password:password];
    //works fine
    [helper fetchUserSpreadsheetFeed];
    //inside the helper class, fetchUserSpreadsheet feed calls ANOTHER method, which
    //calls ANOTHER METHOD and so on, until the object is either uploaded or fails
    //However, once the class gets to the end of fetchUserSpreadsheetFeed
    //control is passed back to this method, and
    [pool release];
    //is called.  The thread terminates and nothing ever happens.
}

If I forget about using a separate thread, everything works like it’s supposed to. I’m new to thread programming, so if there’s something I’m missing, please clue me in!

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-15T03:43:13+00:00Added an answer on May 15, 2026 at 3:43 am

    I’ve had this problem and I have a solution, however, the solution kind of makes me cringe as it works, but something smells about it… it seems like their should be a better way.

    I suspect somewhere within [helper fetchUserSpreadsheetFeed] you are using some form of NSURLConnection. If you are using an asynchronous http request (where you setup the delegate for callback functions and such) the thread may terminate before the connection has a chance to invoke those callback functions and silently fail. Here’s my solution which keeps the thread alive until the callbacks set a ‘finished’ variable to YES. (I also seem to have trouble posting code in these text boxes so if those angels that run around editing stuff can help me out that’d be great!)

    - (void)fetchFeed {
    //NSLog(@"making request");
    [WLUtilities makeHttpRequest:self.feedUrlString withHttpHeaders:nil withDelegate:self];
    
    //block this thread so it's still alive when the delegates get called
    while(!finished) {
        [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
    }
    

    }

    The problem I have with this solution is that spinning while loops are generally not good practice. I’m not sure as to the nature of the runloop business though, it may be properly sleeping and stuff but I’m not sure.

    At any rate, you could give that a try and see what happens!

    NOTE: my “WLUtilities” function is just a wrapper around the NSURLConnection function to create an asynchronous http request. Another solution you might try is simply using a synchronus request but I don’t like this solution much either because the asynchronous call offers finer grained control over the connection.

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

Sidebar

Ask A Question

Stats

  • Questions 403k
  • Answers 403k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You probably have a problem on the other end. read()… May 15, 2026 at 5:16 am
  • Editorial Team
    Editorial Team added an answer I would say the answer hasn't changed, still the jQuery… May 15, 2026 at 5:16 am
  • Editorial Team
    Editorial Team added an answer It's the Unicode Character 'ZERO WIDTH SPACE' (U+200B). this character… May 15, 2026 at 5:16 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.