0

I'm trying to use Theos in order to hook up and capture the names of the alarms that have been stopped.

I have done this:

// 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

The problem is that I never see the alertbox. Do you have any ideas why this is?

Marti Markov
  • 746
  • 6
  • 25

1 Answers1

0

After [alert show]; put [alert release]; This:

%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   
Ekta Padaliya
  • 5,743
  • 3
  • 39
  • 51
Robin Vekety
  • 89
  • 3
  • 9
  • So does that mean that when I use Logos there is not ARC support? Also I can't test the code right now. I'll do it today and report back. Are you sure this is the correct method to hook onto because I tried it with NSLog instead of UIAlertView and nothing was put inside the console? – Marti Markov Mar 28 '14 at 15:23
  • Then the handle alarm weren't called. Are you sure about it is arg1 arg2 and not fp8 fp12 (I never saw arg1 arg2 on any dumped header, maybe I just didn't noticed them). Try to call the method manualy from applicationDidBecome, and watch the logs – Robin Vekety Mar 28 '14 at 18:51
  • As far as I got it the argument names don't matter because I'm referencing them when passing to the original %orig method. Am I correct on this one? – Marti Markov Mar 28 '14 at 21:22