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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:07:35+00:00 2026-05-22T02:07:35+00:00

So far my apps have been pretty simple, but now I’m finding I need

  • 0

So far my apps have been pretty simple, but now I’m finding I need to run a process on a separate thread, so this is an xCode 101 question asking how I do that.

I want to run a process that runs when the app launches, so I want to execute it in AppDelegate.applicationDidFinishLaunching.

From what I’ve read, I think this is all I need to do, but please correct me if I’m wrong.

// *** AppDelegate.m ****

- (void)applicationDidFinishLaunching:(UIApplication *)application { 

    [NSThread detachNewThreadSelector:@selector([XMLParser parseXML:]) 
        toTarget:self
        withObject:requestStr];

}

// *** XMLParser.m ***

-(void)parseXML {

    // Dunno why NSAutoreleasePool is needed but apparently it is

    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

    // . . . my code

    [pool 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-22T02:07:36+00:00Added an answer on May 22, 2026 at 2:07 am

    There is some problem i think, @selector expects a selector not a method call. So the correct one should be like this

    - (void)applicationDidFinishLaunching:(UIApplication *)application { 
    
        [NSThread detachNewThreadSelector:@selector(parseXML:) 
            toTarget:objXMLParser
            withObject:requestStr];
    
    }
    
    //here the taget is the object whose selector you are passing. so you can't use self there as parseXML: is the method of XMLParser class
    
    // *** XMLParser.m ***
    
    -(void)parseXML {
    
        // Dunno why NSAutoreleasePool is needed but apparently it is
    
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    
        // . . . my code
    
        [pool release];
    
    }
    

    // Autorelease pool is needed as it is a separate thread, and your code might use some cocoa or your own calls/methods/code that autoreleases an object that’s why you have to keep an auto release pool for those autoreleased objects. if your code doesn’t use any [obj autorelease] statement or doesn’t auto release an object in that case you can omit auto release pool statements, but it’s a good practice to keep it.

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

Sidebar

Related Questions

All my views/pages in apps so far have been full screen UIViewControllers that i
So far I've been enjoying using CodeIgniter to create some simple web apps (really
So far I have been creating Silverlight apps with all logic crunched into a
I have been developing ActionScript apps for half a year or so. As far
I have been stuck with this problem for a while now, and I just
I have been in search of a good way to write curses apps. So
As far as I understand, applications made with Adobe AIR have been blocked from
Hi Im new to Ruby On Rails, but have experience building iPhone apps. So
A bit of background: I have been developing apps for the past 2 years
I have been researching for this and read different opinions but i wanted to

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.