Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/114.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在调整中使用HBPreferences_Ios_Objective C_Jailbreak_Theos - Fatal编程技术网

Ios 在调整中使用HBPreferences

Ios 在调整中使用HBPreferences,ios,objective-c,jailbreak,theos,Ios,Objective C,Jailbreak,Theos,我们什么时候用这个?它注册了一个变量!我们可以使用iPhonedevwiki中给出的古老而简单的方法来实现这一点,并添加一个观察者来观察偏好的变化。但我看到一些调整使用了HBPreferences,而不是iPhonedevwiki中给出的方法。有人能告诉我它是如何工作的吗?它比iPhonedevwiki中给出的方法好吗?谢谢 你可以这样使用它 static NSString *const kHBCBPreferencesDomain = @"ws.hbang.cobalia"; static N

我们什么时候用这个?它注册了一个变量!我们可以使用iPhonedevwiki中给出的古老而简单的方法来实现这一点,并添加一个观察者来观察偏好的变化。但我看到一些调整使用了HBPreferences,而不是iPhonedevwiki中给出的方法。有人能告诉我它是如何工作的吗?它比iPhonedevwiki中给出的方法好吗?谢谢

你可以这样使用它

static NSString *const kHBCBPreferencesDomain = @"ws.hbang.cobalia";
static NSString *const kHBCBPreferencesEnabledKey = @"Enabled";
static NSString *const kHBCBPreferencesSwitchesKey = @"Switches";
static NSString *const kHBCBPreferencesSectionLabelKey = @"SectionLabel";
static NSString *const kHBCBPreferencesSwitchLabelsKey = @"SwitchLabels";

HBPreferences *preferences = [[HBPreferences alloc] initWithIdentifier:kHBCBPreferencesDomain];

[preferences registerDefaults:@{
    kHBCBPreferencesEnabledKey: @YES,
    kHBCBPreferencesSwitchesKey: @[ /* ... */ ],
    kHBCBPreferencesSectionLabelKey: @YES,
    kHBCBPreferencesSwitchLabelsKey: @YES
}];
并添加观察者以进行更改

void HBCBPreferencesChanged() {
    //Will be called when changes occur
}

/* Call this function to register an observer */
void addObserver(){
    CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)HBCBPreferencesChanged, CFSTR("ws.hbang.cobalia/ReloadPrefs"), NULL, kNilOptions);
}

您可以阅读更多关于它的信息,或者像这样使用它

static NSString *const kHBCBPreferencesDomain = @"ws.hbang.cobalia";
static NSString *const kHBCBPreferencesEnabledKey = @"Enabled";
static NSString *const kHBCBPreferencesSwitchesKey = @"Switches";
static NSString *const kHBCBPreferencesSectionLabelKey = @"SectionLabel";
static NSString *const kHBCBPreferencesSwitchLabelsKey = @"SwitchLabels";

HBPreferences *preferences = [[HBPreferences alloc] initWithIdentifier:kHBCBPreferencesDomain];

[preferences registerDefaults:@{
    kHBCBPreferencesEnabledKey: @YES,
    kHBCBPreferencesSwitchesKey: @[ /* ... */ ],
    kHBCBPreferencesSectionLabelKey: @YES,
    kHBCBPreferencesSwitchLabelsKey: @YES
}];
并添加观察者以进行更改

void HBCBPreferencesChanged() {
    //Will be called when changes occur
}

/* Call this function to register an observer */
void addObserver(){
    CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)HBCBPreferencesChanged, CFSTR("ws.hbang.cobalia/ReloadPrefs"), NULL, kNilOptions);
}

您可以阅读更多关于它的信息,或者

您是否可以添加更多信息,例如指向iphonedevwiki文章的链接?@vrwim@vrwim不幸的是,我所说的不在iphonedevwiki上。您是否可以添加更多信息,比如一个关于iphonedevwiki的文章的链接?@vrwim@vrwim不幸的是,我所说的不在iphonedevwiki上。