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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:38:40+00:00 2026-05-26T02:38:40+00:00

I have a class object that i’m using a lot from different places. Now

  • 0

I have a class object that i’m using a lot from different places.

Now i’m using the class like this:

myClass.delegate = self;
[myClass doSomething];

doSomething creates a new class object that calculate stuff and can take up to 1 min before it sends back a result to the delegate like this:

-(void)doSomething {
   CalculateStuff *calc = [[calculateStuff alloc] init];
   calc.delegate = self;
   [calc calculate];
}

/* Calculate Delegate */
-(void)didCalculate {
   [[self delegate] didDoSomething];
}

Problem is that i from another place is calling the same thing it will call my latest delegate and this causes a lot of problems.

Question:

Is there a way to send the delegate as an object without having to set it as the property?
I’ve written it like this and Xcode give me warnings “Incomplete implementation of MyClass”

[myClass doSomethingWithDelegate:self];

And

-(void)doSomethingWithDelegate:(id)delegate {
   CalculateStuff *calc = [[calculateStuff alloc] init];
   [calc calculateWithDelegate:delegate];
}

/* Calculate Delegate */
-(void)didCalculateWithDelegate:(id)delegate {
   [delegate didDoSomething];
}

EDIT
Just tried it out and it seems to work, but how can i get rid of the warnings in Xcode?

  • 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-26T02:38:41+00:00Added an answer on May 26, 2026 at 2:38 am

    I think your problem is that you forgot to remove the declaration of doSomething and didCalculate from your class’s interface (or class extension).


    Ideally you should create a protocol to ensure that your delegate has the required method(s). For instance:

    @protocol DoSomethingDelegate <NSObject>
    - (void)didDoSomething;
    @end
    

    Then use id<DoSomethingDelegate> instead of just id.


    Passing a block would also be a valid solution to this problem, although it’s a bit trickier.

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

Sidebar

Related Questions

I have a list of class items List<MyClass> I have a seperate object that
Example: I have an class that inherits from UIImageView. An object creates an instance
I have a object cache class like this: #include boost/thread/mutex.hpp #include boost/unordered_map.hpp template <typename
Let's say I have objects which look very roughly like this: class object {
We have the Class object (an object that reference a Class) so you can
I have a class that spawns an arbitrary number of worker object that compute
D2.0 classes have a __monitor class property that gives access to the class object's
I have an object that is generated in one class public class CreatingClass {
I have an ExpenseType object that I have created with the following migration: class
I have a Grails command object that contains an emailAddresses field, e.g. public class

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.