Apple has deprecated NSObject‘s poseAsClass: method for OS X v10.5 and above. Is there another way to make class posing work?
Apple has deprecated NSObject ‘s poseAsClass: method for OS X v10.5 and above. Is
Share
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.
I don’t think there is a class-level equivalent, but you can exchange the implementation of two methods, which was often the purpose of using
poseAsClass:(of course, you can exchange more than one method if you need to override multiple methods in a class). You want method_exchangeImplementations in the Objective-C 2.0 runtime (#import objc/runtime.h). A word of warning: after calling method_exchangeImplementations, calling the ‘new’ method actually calls the original method definition.