1

Okay so i am wanting to create a tweak that hooks into the MPMovieController.h file and changes the scaling button to another button. So firstly i checked i can hook into that class just for testing reason, so i hooked into the play function to see if when a video had began playing if i could show a UIAlertView. However I was unable to do so. Even though everything compiled fine and the DEB file was built successfully I still can not get this message to appear when the movie player is playing.

This is my Code:

Tweak.xm:

#import <UIKit/UIKit.h>
@interface MPMoviePlayerController
-(void)play;
@end

%hook MPMoviePlayerController
-(void)play
{
    NSString *Title = [NSString stringWithFormat:@"Title", nil];
    NSString *message = [NSString stringWithFormat:@"Message", nil];
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:Title message:message delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];
    [alert release];
%orig;
}
%end

Thanks. P.S. After Installing I have reset and re-sprung my iphone.

Nirav Bhatt
  • 6,940
  • 5
  • 45
  • 89
Tom
  • 640
  • 1
  • 7
  • 25
  • Building a theos project results in a `dylib` and a `plist` file. Are you sure you're putting these in the right spot? – esqew Jul 29 '14 at 17:25
  • Which app are you testing in? Safari will not work as WebKit will load MediaPlayer.framework in such a way that theos can't hook into it. Try another app instead, or if you want Safari compatibility, simply link MediaPlayer when compiling, and add com.apple.MobileSafari into your [tweak name].plist file. – epetousis Aug 06 '14 at 10:28
  • Also, make sure that you are hooking into the MediaPlayer framework in the first place by adding "com.apple.MediaPlayer" into your [tweak name].plist file. – epetousis Aug 06 '14 at 10:29

0 Answers0