2015-04-23 70 views
0

我最近一直在嘗試使用Theos和Obj-C進入iOS開發。我目前正在嘗試爲運行8.1.1的iPhone 5s進行微調,這個版本已經越獄了。我目前正在通過SSH編譯設備上的所有內容。我一直在試圖編寫一個調整,只要在加載Springboard的時候顯示一個警報(就在設備第一次重新啓動後)。儘管四處搜尋,我還沒有找到解決辦法。當我安裝.deb並respring時,我看不到任何警報。我很困惑,爲什麼它沒有顯示,這裏是我的tweak.xm文件中的代碼。加載Springboard時發出警報顯示iOS

%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

我可以張貼我的控制,並在需要的Makefile爲好。

總結: 包是用該代碼創建的,但它什麼都不做。我想知道爲什麼以及如何修復它,以便在加載Springboard時顯示警報。

感謝您的閱讀

回答

1

使用鎖定屏幕的視圖控制器。鉤SBLockScreenViewControllerviewDidAppear