挂钩音乐播放器功能 IOS 8



当调用快进函数时,我正在尝试在音乐播放器中钩住 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

这是我的制作文件:

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>

任何帮助将不胜感激。

问候。

好吧,似乎只是在 plist 音乐中,大写字母必须与 M 一起,com.apple.Music 而不是 com.apple.music... :P

相关内容

  • 没有找到相关文章

最新更新