Post

Replies

Boosts

Views

Activity

Why would class_getInstanceMethod return nil?
I am running into a problem when I attemp to call class_getInstanceMethod on a selected method in the parent class of a category I am writting.When I try to set the original method implementation using class_getInstanceMethod, it is returning 'nil'.When I try to set the Method implementation on a method in my category, it is not having any issues. Here is an example of what I am trying to do;// Thirdparty Library class in a CocoaPod // ThirdPartyLogger.h @interface ThirdPartyLogger : NSObject -(instancetype)init; -(void)deleteLogFiles; @end //ThirdPartyLogger.m #import "ThirdPartyLogger.h" @implementation - (instancetype)init { [self super]; return self; } -(void)deleteLogFiles { // original implementation } @end // Here is my code // ThirdPartyLogger+David.h #import "ThirdPartyLogger.h" @interface ThirdPartyLogger (David) - (void)deleteLogFilesDavid; @end // ThirdPartyLogger+David.m #import "ThirdPartyLogger+David.h" @implementation -(void)deleteLogFilesDavid { // new implementation } +(void)load { original = class_getInstanceMethod(self, @selector(deleteLogFiles)); // returns nil :-( swizzled = class_getInstanceMethod(self, @selector(deleteLogFilesDavid)); // returns a valid method implementation method_exchangeImplementations(original, swizzled); } @endAny ideas?
1
0
1.1k
Jun ’18
chown: /usr/local: Operation not permitted
I am trying to get homebrew working on my macOS high sierra machine. It will not run because there is a permissions issue. When I run `brew doctor`, I get the following message;run the following command to fix permissions: "sudo chown -R $(whoami) /usr/local"When I try to run the chown, I am getting the following error;"chown: /usr/local: Operation not permitted"Bueller?
11
0
17k
Jul ’17