gpt4 book ai didi

ios - 如何从设置 Pane 分配激活器操作

转载 作者:搜寻专家 更新时间:2023-10-30 20:17:00 25 4
gpt4 key购买 nike

我正在遵循本指南 http://www.iphonedevwiki.net/index.php/Libactivator从设置 Pane (设置应用程序)更改激活方法。它不起作用。但是我通过 Activator 更改了激活方法(从 Cydia 源下载并安装),它可以正常工作。那么,我的错误在哪里?

控制

Package: com.example.mytweak
Name: MyTweak
Description: A simple MobileSubstrate tweak!
Version: 0.0.1
Priority: optional
Section: Tweaks
Architecture: iphoneos-arm
Depends: mobilesubstrate, libactivator
Maintainer: Maintainer name
Author: Author name

生成文件

include theos/makefiles/common.mk

TWEAK_NAME = MyTweak
MyTweak_FILES = Tweak.xm
MyTweak_FRAMEWORKS = UIKit AVFoundation
MyTweak_LIBRARIES = activator

include $(THEOS_MAKE_PATH)/tweak.mk

internal-stage::
#PreferenceLoader plist
$(ECHO_NOTHING)mkdir -p $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences$(ECHO_END)
$(ECHO_NOTHING)cp Preferences.plist $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences/MyTweak.plist$(ECHO_END)

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

MyTweak.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.springboard</string>
</array>
</dict>
</dict>
</plist>

Preferences.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>entry</key>
<dict>
<key>cell</key>
<string>PSLinkCell</string>
<key>defaults</key>
<string>com.example.mytweak</string>
<key>label</key>
<string>MyTweak</string>
<key>key</key>
<string>enabled</string>
<key>default</key>
<true/>
<key>icon</key>
<string>/Applications/Preferences.app/icon-table@2x.png</string>
<key>PostNotification</key>
<string>com.example.mytweak/preferences.changed</string>
<key>items</key>
<array>
<dict>
<key>cell</key>
<string>PSLinkCell</string>
<key>label</key>
<string>Activation Methods</string>
<key>isController</key>
<true/>
<key>bundle</key>
<string>LibActivator</string>
<key>activatorListener</key>
<string>com.example.mytweak</string>
</dict>
</array>
</dict>
</dict>
</plist>

Tweak.xm

#import <libactivator/libactivator.h>

@interface MyTweakListener : NSObject <LAListener>
@end

@implementation MyTweakListener

- (void)activator:(LAActivator *)activator receiveEvent:(LAEvent *)event {
// Do something
[event setHandled:YES];
}

- (void)activator:(LAActivator *)activator abortEvent:(LAEvent *)event {
// Do something
}

+ (void)load {
if ([LASharedActivator isRunningInsideSpringBoard]) {
[LASharedActivator registerListener:[self new] forName:@"MyTweak"];
}
}

@end

最佳答案

我尝试了很多解决方案,并找到了正确的解决方案。我需要修改 LAListener 实现

#1:为监听器添加标题

- (NSString *)activator:(LAActivator *)activator requiresLocalizedTitleForListenerName:(NSString *)listenerName {
return @"onClan Assistive Touch";
}

#2:更改监听器名称

之前:

+ (void)load {
if ([LASharedActivator isRunningInsideSpringBoard]) {
[LASharedActivator registerListener:[self new] forName:@"MyTweak"];
}
}

之后:

+ (void)load {
if ([LASharedActivator isRunningInsideSpringBoard]) {
[LASharedActivator registerListener:[self new] forName:@"com.example.mytweak"];
}
}

关于ios - 如何从设置 Pane 分配激活器操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26777774/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com