如何挂钩到iOS报警功能?

时间:2014-01-02 03:05:08

标签: objective-c ios7 tweak cydia-substrate

我正在尝试使用Theos来连接并捕获已停止的警报的名称。

我做到了:

// Logos by Dustin Howett
// See http://iphonedevwiki.net/index.php/Logos
//#import <SpringBoard/SpringBoard.h>
#import <MobileTimer/AlarmManager.h>
//#import <SpringBoard/SBApplicationIcon.h>
#import <UIKit/UIKit.h>
//#import <SpringBoard/SBRemoteNotificationEnableSystemwideAlert.h>

%hook AlarmManager

- (void)handleAlarm:(id)arg1 stoppedUsingSong:(id)arg2 {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"ALARM!!!!" message:@"HELLO!!!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];
    %orig(arg1,arg2);
}
%end

问题是我从未见过警告框。你有什么想法吗?

1 个答案:

答案 0 :(得分:0)

[alert show]; [alert release];之后  这样:

%hook AlarmManager 
    - (void)handleAlarm:(id)arg1 stoppedUsingSong:(id)arg2 {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"ALARM!!!!" message:@"HELLO!!!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];
    [alert release];
    %orig(arg1,arg2);
}
%end