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

  • Home
  • SEARCH
  • 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 6241481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:46:32+00:00 2026-05-24T11:46:32+00:00

using the Method * class_copyMethodList(Class cls, unsigned int *outCount) function one can get a

  • 0

using the “Method * class_copyMethodList(Class cls, unsigned int *outCount)” function one can get a list of all methods that exist on an objective-C class.

I would like to know how to find which of these methods are constructors as I am writing an IOC container. I would like to determine the constructors and their parameter types.

  • 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-24T11:46:33+00:00Added an answer on May 24, 2026 at 11:46 am

    I would like to know how to find which of these methods are
    constructors as I am writing an IOC container. I would like to
    determine the constructors and their parameter types.

    In short, you can’t. Or, at the least, you’ll find that down this path lies madness.

    First, Objective-C does not have constructors. It has initializers, sometimes many, and — for a properly written class — only one of which is the designated initializer. There is no way to identify the designated initializer at compile time or run time.

    How do I use this with a Method * and no instantiated member of the
    class?

    You don’t. First you allocate an instance of the class, then you initialize the instance.

    Overall, this level of abstraction just isn’t done in Objective-C outside of academic investigations. It can be done, but it is generally avoided because of the fragility of the resulting solution and the hairball of code-hell that is trying to dynamically support the underlying C ABI (go look at the source to libffi).

    If you want to go down this path, then you are far better off either defining a custom abstract class that all of your containers will subclass that can provide the binding logic to the class behind it.

    Or use protocols; i.e. a class could implement an IOCBean protocol and one method would be initIOCGoop that is the designated initializer goo.

    Doing this generically for all classes is going to be rife with fragility, special cases, and will require a gigantic mess of code that will be difficult to maintain over time.

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

Sidebar

Related Questions

I’m using the Objective-C runtime library, function class_copyMethodList(), to get a list of all
How can I get the list of class methods for a particular Class? I've
I'm deserializing a class called Method using .NET Serialization. Method contains a list of
I'm using Java. I want to have a setter method of one class that
I'm currently using this method: class Foo { private static $num_instances = 0; function
I'm using UIView class method animateWithDuration for repeating my view animation. How can I
can anyone tell me how to create a class method and using that how
I often auto-generate an class's hashCode() method using IntelliJ IDEA and typically the method
I am using java.util.Timer class and I am using its schedule method to perform
I've tried reading a JPG file using the StreamReader class' ReadToEnd() method which returns

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.