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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:12:43+00:00 2026-06-07T09:12:43+00:00

I currently have a UIViewController and a NSObject class. What i want to do

  • 0

I currently have a UIViewController and a NSObject class.

What i want to do is to tell the NSObject class to perform an action and then tell the UIViewController when it has finished it’s action.

I’m calling the object to perform it’s action like so:

[fooObject performActionWithDelegate:self];

The performActionWithDelegate function basically only takes the UIViewcontroller’s delegate to perform a callback.

-(void)performActionWithDelegate:(id)d{

    // bar is declared in the fooObject header file
    // id bar;

    [bar setDelegate:d];

    [bar performCallback];

}

Where performCallback is a simple NSLog()-statement in the UIViewController:

-(void)performCallback{

    NSLog(@"Successfully performed a callback");    

{

Now, i’d like this to work. My first guess is that this is not the best approach to this problem.

The full scope of the problem is that the fooObject is supposed to perform a httppost to a webservice to update one of it’s properties and then inform the uiviewcontroller if the operation was successful or not.

How do i achieve this?

Any tips and/or pointers will be highly appreciated!

Thanks in advance.

Edit:
The actual problem is that the fooObject is not performing the callback.

  • 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-07T09:12:46+00:00Added an answer on June 7, 2026 at 9:12 am

    Its not clear exactly what you are trying to accomplish. What you are doing seems related to two different design patterns:

    • Delegate
    • Asynchronous callback

    Delegate: You would use a delegate if there is some reason to separate out some of the functionality of your UIViewController into another object. Instead of the UIViewController doing something it asks another object to do it. This is commonly used for code reuse so you can have the same UIViewController serve in different cases and just change the delegate to change some of its behavior.

    Asynchronous callback: This allows an operation to occur in the background while you are doing other things and then be notified by calling a method of your object when the operation completes. You can do this without involving other objects.

    In your case, why do you want to perform an HTTP post to a web service outside of our UIViewController? Do you just want to separate the network code from UI code? In this case, you don’t really need a delegate, just call the method on the other object from your UIViewController and when it returns, its done. It can pass back any result you need in other parameters. Returning values by setting properties on the calling object is not generally a very good design. Even if you do this the UIViewController isn’t really a “delegate”.

    On the other hand if you are concerned about blocking the main thread while the HTTP post is in process then you will want to use something like asynchronous callback. The easiest way to do this is to use Grand Central Dispatch. Conceptually you could do something like this:

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
      [self doLongHTTPPost];
      dispatch_async(dispatch_get_main_queue(), ^{ [self longHTTPPostDone]; });
    });
    

    This will call doLongHTTPPost in the background and then at some later time after it is complete it will call longHTTPPostDone on the main thread where it is safe to take UI actions.

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

Sidebar

Related Questions

Currently have password protection on my main and sub directories, however I'd like to
I currently have 4 tables. Product, Category, SubCategory, ProductSubCategory. Category has a OneToMany SubCategory
I currently have a MySQL table like: id | friend 1 | 2 1
I have a UIViewController whose view has a custom subview. This custom subview needs
I'm currently making ipad application. I have create an uiviewcontroller which is appear with
I have a root UIViewController subclass that has a UITabBar, (I'm not using UITabBarController)
Here is the situation: I have a class MainView (which is a UIViewController) and
I have a root UIViewController that I am adding other UIViewController's as subviews. Currently
I currently have a UITextView which is contained in a UIViewController using the following
I have a UIViewController that is pushed onto a UINavigationController and is currently displayed.

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.