按照楼主的书,敲下去的,但是我的tweak,为什么不起作用,点击home后,InComing Calls未改变????
#import <notify.h>
%hook SpringBoard
- (void)menuButtonDown:(id)down
{
%orig;
NSLog(@"helloWorldMenuButtonDownFirst");
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preference/com.apple.Accessibility.plist"];
[dict setObject:[NSNumber numberWithInteger:2] forKey:@"DefaultRouteForCallPreference"];
[dict writeToFile:@"/var/mobile/Library/Preference/com.apple.Accessibility.plist" atomically:YES];
notify_post("com.apple.accessibility.defaultrouteforcall");
NSLog(@"helloWorldMenuButtonDownEnd");
}
%end
我发现我点击home键,通过grep搜索helloWorldMenuButtonDownFirst 都搜不到,感觉我的menuButtonDown方法好像都没有调用???这事怎么回事啊啊???
然后我用HOOK saveScreenshot,通过截屏来运行上面代码,syslog有执行helloWorldMenuButtonDownFirst,但是InComing Calls未改变,还是Default??