Я пишу свою первую настройку для iOS с помощью theos, и я застреваю в оптимизации. Как я могу видеть, dylib будет проверять каждый раз (каждую секунду?) »([[Settings objectForKey: @" что-то "] boolValue])" и "[[settings objectForKey: @" SomethingHere "] boolValue]" в файле plist.Советы по оптимизации (THEOS)
В порядке ли? Любое предложение для оптимизации? Вот мой твик:
%hook Something
- (void)somethingheree:(_Bool)arg1 withNumberOfDevices:(int)arg2
{
NSMutableDictionary *settings = [NSMutableDictionary dictionaryWithContentsOfFile:
[NSString stringWithFormat:@"%@/Library/Preferences/%@", NSHomeDirectory(), @"com.yourcompany.mytweak.plist"]];
if([[settings objectForKey:@"something"] boolValue]) {
%orig(YES,100);
}
else %orig;
}
%end
%hook somethinganother
- (void)somethinghere:(_Bool)arg1
{
NSMutableDictionary *settings = [NSMutableDictionary dictionaryWithContentsOfFile:
[NSString stringWithFormat:@"%@/Library/Preferences/%@", NSHomeDirectory(), @"com.yourcompany.mytweak.plist"]];
if([[settings objectForKey:@"SomethingHere"] boolValue]) {
%orig(NO);
} else %orig;
}
%end