hook音乐播放器功能IOS 8

时间:2014-11-30 12:55:21

标签: ios ios8 theos mpavcontroller

我在调用快进功能时尝试Theos /挂钩音乐播放器中的endSeek功能,我在IOS 8.1中 问题是我从未达到调用endSeek的程度,我在调用函数时设置了警报,但它从未显示过。 我已对代码进行了评论,因此仅显示警报。

这是我的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

这是我的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"

和.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>

任何帮助都将不胜感激。

问候。

1 个答案:

答案 0 :(得分:0)

嗯,似乎它只是在plist音乐必须与M在首都,com.apple.Music而不是com.apple.music ......:P