我最近一直在尝试使用 Theos 和 Obj-C 进行 iOS 开发。我目前正在尝试为已越狱的运行 8.1.1 的 iPhone 5s 编写调整。我目前正在通过 SSH 编译设备上的所有内容。我一直在尝试编写一个调整,只要加载 Springboard 就会显示一个警报(所以在设备第一次重新启动之后)。尽管四处寻找,我还没有找到解决方案。当我安装 .deb 并重新启动时,我没有看到任何警报。我很困惑为什么它没有显示,这是我在我的tweak.xm 文件中的代码。
%hook SpringBoard // Hook SpringBoard, because that is the class that has the method you want to hook
-(void)applicationDidFinishLaunching // When this method is called, you want to execute your code
{
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"AlertView in iOS 8" message:nil preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[self dismissViewControllerAnimated:YES completion:nil];
}]];
[self presentViewController:alertController animated:YES completion:nil];
%orig; // call normal function so SpringBoard loads.
}
%end
我在那里获得该代码非常困难,所以这是一个模式可读的版本https://ghostbin.com/paste/fmv6m
如果需要,我也可以发布我的控件和生成文件。
总结一下:这个包是用那个代码创建的,但它什么也没做。我想知道为什么以及如何修复它,以便在加载 Springboard 时显示警报。
感谢您阅读