2

I'm trying to Theos/hook the endSeek function in music player when fast forward function is called, I'm in IOS 8.1 The problem is I never reach to the point where endSeek is called, I've set an alert whenever the function is called, but it never shows. I've commented the code, so only alert is displayed.

This is my code for the tweak.xm:

@interface MPAVController:NSObject {}

    - (unsigned int)_displayPlaybackState;
    - (void)endSeek;

@end


@interface MPMusicPlayerController:NSObject {}
  + (id)systemMusicPlayer;
    - (void)skipToNextItem;
  - (void)skipToPreviousItem;
@end



%hook MPAVController

-(void)endSeek {

  %orig;

  NSString *str1 = @"Now in seek!";
  UIAlertView *alert1 = [[UIAlertView alloc] initWithTitle:@"Title"
       message:str1
        delegate:nil 
        cancelButtonTitle:@"Cancel" 
        otherButtonTitles:nil];
  [alert1 show];
  [alert1 release]; 

    /*switch ( [self _displayPlaybackState] )
    {
        case 4:
            %orig;
            [[MPMusicPlayerController systemMusicPlayer] skipToNextItem];
                break;
        case 5:
                %orig;
            [[MPMusicPlayerController systemMusicPlayer] skipToPreviousItem];
                break;
        default:
                NSString *str = [NSString stringWithFormat:@"%d",[self _displayPlaybackState]];
                %orig;
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Titulo" 
                    message:str
                    delegate:nil 
                    cancelButtonTitle:@"Adiós Edu" 
                    otherButtonTitles:nil];
//    [alert show];
                [alert release]; 
                break;  
    }*/

}

/* -(void)beginSeek {

switch ( [self _displayPlaybackState] )
{
   case 4:
start = [NSDate date];
   %orig;
   break;
   default:
     %orig;
     break;

} 
}
*/

%end

This is my Makefile:

export ARCHS = arm64
export TARGET = iphone:clang:8.1
include theos/makefiles/common.mk

TWEAK_NAME = replaceSeek
replaceSeek_FILES = Tweak.xm
replaceSeek_FRAMEWORKS = UIKit MediaPlayer

include $(THEOS_MAKE_PATH)/tweak.mk

after-install::
    install.exec "killall -9 SpringBoard"

and .plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Filter</key>
    <dict>
        <key>Bundles</key>
        <array>
            <string>com.apple.music</string>
        </array>
    </dict>
</dict>
</plist>

Any help would be appreciated.

Regards.

1 Answers1

0

Well, it seems it was just in plist Music must be with M in capital, com.apple.Music instead of com.apple.music... :P