我正在尝试运行 cycript 命令并从我的工具(由 theos 在越狱的 iphone 上运行)获取 cycript 返回的结果?但这里的问题是 cycript 正在占用主线程,似乎让我的工具挂在那里。有没有办法做到这一点?这是我用来测试它的代码:
-(NSString*)getTestCycript:(NSString*)appname {
@try {
NSLog(@"Executing command...");
NSString *command = [[[NSString alloc] init] autorelease];
NSString *result = [[[NSString alloc] init] autorelease];
command = [NSString stringWithFormat:@"cycript -p %@", appname];
result = [self runCommand:command];
command = [NSString stringWithFormat:@"UIApp.keyWindow.recursiveDescription().toString()"];
result = [self runCommand:command];
return result;
}
@catch (NSException * e) {
}
}