当调用快进功能时,我正在尝试 Theos/hook 音乐播放器中的 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>
任何帮助,将不胜感激。
问候。