书上105页那个测试函数.
代码为:
%hook SpringBoard
- (void) menuButtonDown:(id)down
{
%orig;
SBScreenShotter *shotter = %c(SBScreenShotter) sharedInstance];
[shotter saveScreenshot];
}
%end
对应的makefile为
THEOS_DEVICE_IP = 192.168.1.252
ARCHS = armv7 armv7s arm64
TARGET = iphone:8.1:5.0
include theos/makefiles/common.mk
TWEAK_NAME = hoolSprpingB
hoolSprpingB_FILES = Tweak.xm
include $(THEOS_MAKE_PATH)/tweak.mk
after-install::
install.exec "killall -9 SpringBoard"
在工程目录下make,提示如下错误.
Making all for tweak hoolSprpingB...
Preprocessing Tweak.xm...
Compiling Tweak.xm...
Tweak.xm:5:74: error: class method '+sharedInstance' not found (return type
defaults to 'id') -Werror,-Wobjc-method-access]
...= [_logos_static_class_lookup$SBScreenShotter() sharedInstance];
^~~~~~~~~~~~~~
Tweak.xm:6:10: error: instance method '-saveScreenshot' not found (return type
defaults to 'id') -Werror,-Wobjc-method-access]
[shotter saveScreenshot];
^~~~~~~~~~~~~~
Tweak.xm:3:8: note: receiver is instance of class declared here
@class SBScreenShotter; @class SpringBoard;
^
2 errors generated.
make[2]: *** [obj/Tweak.xm.e6ba7d32.o] Error 1
make[1]: *** [internal-library-all_] Error 2
make: *** [hoolSprpingB.all.tweak.variables] Error 2
求大神解答.