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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:29:03+00:00 2026-06-04T19:29:03+00:00

Hi how can I fire functions and methods in a queue in Objective C

  • 0

Hi how can I fire functions and methods in a queue in Objective C ? I mean something like this :

method 1 then method 2 then method 3 , Should I use NSThread ?

  • 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-06-04T19:29:04+00:00Added an answer on June 4, 2026 at 7:29 pm

    I have a different solution that involved in using GCD Serial Queues and NSSelectorFromString method.

    1st: Create an array with your methods names

    2nd: Create a GCD Serial Queue

    3rd: Using NSSelectorFromString to convert method name string to method and insert it into the serial Q using the a for loop, etc.

    Here is the complete tested code:

    - (IBAction)buttonSerialQPressed:(id)sender 
    {
        dispatch_queue_t serialdQueue;
        serialdQueue = dispatch_queue_create("com.mydomain.testbed.serialQ", NULL);
    
        NSArray *arrayMethods = [NSArray arrayWithObjects:@"method1", @"method2", @"method3", nil];
        for (NSString *methodName in arrayMethods) 
        {
            dispatch_async(serialdQueue, ^{
                SEL myMethod = NSSelectorFromString(methodName);
                [self performSelector:myMethod];
            });
        }
    }
    
    -(void)method1
    {
        for (int i=0; i<1000; i++) 
        {
            NSLog(@"method1 i: %i", i);
        }
    }
    
    -(void)method2
    {
        for (int i=0; i<10; i++) 
        {
            NSLog(@"method2 i: %i", i);
        }
    }
    
    -(void)method3
    {
        for (int i=0; i<100; i++) 
        {
            NSLog(@"method3 i: %i", i);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using this Jquery function for available username check. How can I fire this
Is there anyway I can use native javascript to fire an event called onmove
I must be missing something obvious here... I can't get .change() to fire on
I'm trying to extend a class like panel so that I can fire click
I'm trying to use JQuery to have a method fire when the following code
I want to have a generic event that I can fire that will take
I have an event, which can fire itself. I try to make the code
I can get MouseEnter , MouseLeave , and Click events to fire, but not
Due to an issue where I can't get the NSURLRequest timeout to fire in
Can someone please explain why this doesn't work? MyClass myClass1 = new MyClass(); object

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.