为模拟器构建时未定义的体系结构符号 x86_64
Undefined symbols for architecture x86_64 when building for Simulator
我正在使用 imp_implementationForwardingToSelector 库将 IMP 转发到不同的选择器。它在真实设备上运行良好,但在我尝试为模拟器构建时出现错误
错误:体系结构的未定义符号 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);
是否有任何我遗漏的设置或任何其他库建议可以帮助我做同样的事情。
如果您还没有添加 #import <objc/runtime.h>
,请添加
正如 github 页面上的 'limitation' 中所引用的那样,这一定是您的情况,因为它在设备上 运行 但无法在模拟器上运行
imp_implementationForwardingToSelector is written in raw assembly
which is currently only available on i386, armv7, armv7s and arm64.
我正在使用 imp_implementationForwardingToSelector 库将 IMP 转发到不同的选择器。它在真实设备上运行良好,但在我尝试为模拟器构建时出现错误
错误:体系结构的未定义符号 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);
是否有任何我遗漏的设置或任何其他库建议可以帮助我做同样的事情。
如果您还没有添加 #import <objc/runtime.h>
,请添加
正如 github 页面上的 'limitation' 中所引用的那样,这一定是您的情况,因为它在设备上 运行 但无法在模拟器上运行
imp_implementationForwardingToSelector is written in raw assembly which is currently only available on i386, armv7, armv7s and arm64.