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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
If you have a
Class(we’ll call itMyClass), then you have to get its meta class to operate on class methods.In other words:
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