0

I am using the imp_implementationForwardingToSelector lib for IMP forwarding to a different selector. It works fine on real devices but giving error when I am trying to build for simulators

Error: Undefined symbols for architecture x86_64

    SEL forwardingSelector = NSSelectorFromString([NSString stringWithFormat:@"__supert__forwarding__%@__%@", className, methodName]);
    SEL originalSelector = NSSelectorFromString(originalSelectorString);
    IMP forwardingImplementation = imp_implementationForwardingToSelector(forwardingSelector, methodReturnsStructValue);
    class_replaceMethod(class, originalSelector, method_getImplementation(method), typeEncoding);
    method_setImplementation(method, forwardingImplementation);

Is there any setting that I am missing or any other lib suggestion which will help me do the same thing.

user1169079
  • 3,053
  • 5
  • 42
  • 71

1 Answers1

0

Add #import <objc/runtime.h> if you didn't add it yet

As quoted in the 'limitation' on the github pages this must be the case for you as it's running on the device but not working on simulator

imp_implementationForwardingToSelector is written in raw assembly which is currently only available on i386, armv7, armv7s and arm64.

HardikDG
  • 5,892
  • 2
  • 26
  • 55
  • @user1201239 can you please add for which symbols you are getting undefined? you have written only the code not which symbol is getting undefined – HardikDG Apr 17 '16 at 16:53
  • I am using the one of the open source lib, I have hyperlinked that github link in my question – user1169079 Apr 17 '16 at 17:01
  • @user1201239 check the limitation part on github that look like your issue – HardikDG Apr 17 '16 at 17:07