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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:57:19+00:00 2026-05-15T16:57:19+00:00

I have used class_replaceMethod function and it works good with instance methods, but I

  • 0

I have used class_replaceMethod function and it works good with instance methods, but I it doesn’t work with class method replacement.

Has anybody idea why and what should I do to replace class method implementation?

  • 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-15T16:57:20+00:00Added an answer on May 15, 2026 at 4:57 pm

    If you have a Class (we’ll call it MyClass), then you have to get its meta class to operate on class methods.

    In other words:

    Class myClass = [MyClass class];
    unsigned int numInstanceMethods = 0;
    Method * instanceMethods = class_copyMethodList(myClass, &numInstanceMethods);
    //instanceMethods is an array of all instance methods for MyClass
    
    Class myMetaClass = objc_getMetaClass(class_getName(myClass));
    unsigned int numClassMethods = 0;
    Method * classMethods = class_copyMethodList(myMetaClass, &numClassMethods);
    //classMethods is an array of all class methods for MyClass
    

    Basically, the class is for operating on instance-level stuff, and the meta class is for operating on class-level stuff.

    Hopefully this is enough to help you figure out where to go from here. 🙂

    More awesomely useful information: http://www.sealiesoftware.com/blog/archive/2009/04/14/objc_explain_Classes_and_metaclasses.html

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

Sidebar

Related Questions

I have created my custom MembershipProvider. I have used an instance of the class
I have a class named CommonCode that is used for stocking all methods I
I have used Bitmap class to convert tiff to Gif but it couldn't make
I have an Object Factory Class which has a method called registerCreator as defined
I have used Filewriter class. But it will append at the end of the
I have used and learned only virtual methods of the base class without any
I am getting warning: Instance method 'method' is being used on 'Class' which is
i have already searched many places many people have used ABAddressBookRef class but my
I have used custom cell class for my uitableview and used in cellForRowAtIndexPath method.
I have used the draw() method of my SitesOverlay class that is extending the

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.