按照书上第10章 实战4的敲下来,报错

Tweak_PhoneOperation.xm:34:18: error: use of undeclared identifier 'MSHookIvar'
CTCallRef call = MSHookIvar<CTCallRef>(self, "_incomingCall");
                 ^
Tweak_PhoneOperation.xm:34:29: error: unexpected type name 'CTCallRef': expected
      expression
CTCallRef call = MSHookIvar<CTCallRef>(self, "_incomingCall");
                            ^
Tweak_PhoneOperation.xm:34:40: error: expression result unused
      [-Werror,-Wunused-value]
CTCallRef call = MSHookIvar<CTCallRef>(self, "_incomingCall");
                                       ^~~~
Tweak_PhoneOperation.xm:43:18: error: use of undeclared identifier 'MSHookIvar'
CTCallRef call = MSHookIvar<CTCallRef>(self, "_incomingCall");
                 ^
Tweak_PhoneOperation.xm:43:29: error: unexpected type name 'CTCallRef': expected
      expression
CTCallRef call = MSHookIvar<CTCallRef>(self, "_incomingCall");
                            ^
Tweak_PhoneOperation.xm:43:40: error: expression result unused
      [-Werror,-Wunused-value]
CTCallRef call = MSHookIvar<CTCallRef>(self, "_incomingCall");

自己动手,丰衣足食,找到原因了:
1:没有导入#include < logos/logos.h> #include < substrate.h>

2:导入后发现还是这个错误,是因为/opt/theos/include/substrate.h 这个文件没有申明,因为在电脑里装了iOSopenDev,在这个文件里面找到了substrate.h 文件,替换就好了

1 个赞

你好,我也遇到这个问题了,你的回答,我不是很理解,能具体解释一下吗?谢谢你了