我正在尝试对iOS 8的Theos进行调整。它的任命包括在最后一个应用程序关闭时关闭应用程序切换器(当只剩下 SpringBoard 卡时)。以下是完整的源代码(请不要关注UIKit/UIKit.h,我知道肯定还有<>):
#import UIKit/UIKit.h
@interface SBAppSwitcherIconController {
NSMutableArray *_appList;
}
@end
@interface SBAppSwitcherController
- (void)_quitAppWithDisplayItem:(id)arg1;
//custom method
- (void)_dismissAppSwitcher;
@end
@interface SBUIController
+ (id)sharedInstance;
- (void)dismissSwitcherAnimated:(_Bool)arg1;
@end
%hook SBAppSwitcherController
- (void)_quitAppWithDisplayItem:(id)arg1 {
%orig();
if ([[%c(SBAppSwitcherIconController) _appList] count] == 0) {
[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(_dismissAppSwitcher) userInfo:nil repeats:NO];
}
}
%new
- (void)_dismissAppSwitcher {
[[%c(SBUIController) sharedInstance] dismissSwitcherAnimated:YES];
}
%end
当我尝试使用"make package install"命令编译它时,出现此错误:
Tweak.xm:38:65: error: class method '+_appList' not found (return type defaults to 'id') [-Werror,-Wobjc-method-access]
if ([[_logos_static_class_lookup$SBAppSwitcherIconController() _appList] count] == 0) {
谢谢!
SBAppSwitcherIconController 没有类方法"_appList"。您可以在此处查看标题:https://github.com/coolstar/iOS-8.1-SpringBoard-Headers/blob/master/SBAppSwitcherIconController.h
类方法在函数头前面有一个"+"。例如,SBAppSwitcherIconController 有两个类方法(但是这对您的调整没有帮助):
+(float)nominalDistanceBetween5IconCentersForSize:(CGSize)size;
+(float)nominalDistanceBetween3IconCentersForSize:(CGSize)size;