0

I have been fighting with this bizarre all afternoon long with no results. Before, I was able to just create a Tweak, using Theos' Tweak template, and add a PreferenceBundle to it by creating the subproject using the template in its directory. I'd run the tweak, open its page in the Settings.app, and it would loud the specifier list (which includes "Awesome Switch 1" when you don't modify it).

In other words, I'd get this screen by just creating the project doing little to no modifications at all:

enter image description here

Now, today I created a new project the same way (create Tweak first, PreferenceLoader project second) and tried to get to this result with no avail.

I have been fighting with this for over 6 hours. I have tried it in two jailbroken devices. I have uninstalled and re-installed Theos. I have reset my computer, I have rebooted both devices, and no matter what I do, that screen doesn't include it's preferences. It contains the background, but no specifiers at all.

The plist currently looks like this. I need to not the plist tool doesn't return any syntax error when running -lint:

<?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>items</key>
    <array>
        <dict>
            <key>cell</key>
            <string>PSGroupCell</string>
            <key>label</key>
            <string>Five First Page</string>
        </dict>
        <dict>
            <key>cell</key>
            <string>PSSwitchCell</string>
            <key>default</key>
            <true/>
            <key>defaults</key>
            <string>s</string>
            <key>key</key>
            <string>AwesomeSwitch1</string>
            <key>label</key>
            <string>Awesome Switch 1</string>
        </dict>
    </array>
    <key>title</key>
    <string>SomeFive</string>
</dict>
</plist>

(Five.plist. The PreferenceLoader subproject is called "Five").

And the preferences .mm looks like this:

@interface PSListController
-(id)loadSpecifiersFromPlistName:(id)name target:(id)tar;
@end

@interface FiveListController: PSListController
{
    id _specifiers;
}
-(id)specifiers;
@end

@implementation FiveListController
- (id)specifiers {
    if(_specifiers == nil) {
        _specifiers = [[self loadSpecifiersFromPlistName:@"Five" target:self] retain];
    }
    return _specifiers;
}
@end

// vim:ft=objc

Now I know the file exists and is being read properly because I checked if it exists manually in /Library/PreferenceBundles and because you can change the title key in the above plist and it will reflect in the Preference's page navbar title. I'm not sure what is causing it to read the title but not the rest of the specifiers.

I'm completely dumbfounded by this. I have never seen such a weird behavior with PreferenceLoader projects, and it looks like it started completely randomly, as I haven't changed any Theos setting or anything.

Any help with this will be appreciated.

4

1 回答 1

0

我想到了。

问题出在首选项 .mm 文件上。将我提出的问题与这个问题进行比较:

@interface PSListController
{
    id _specifiers;
}
-(id)specifiers;
-(id)loadSpecifiersFromPlistName:(id)name target:(id)target;
@end

@interface NotifierSettingsListController: PSListController {
}
@end

@implementation NotifierSettingsListController
- (id)specifiers {
    if(_specifiers == nil) {
        _specifiers = [[self loadSpecifiersFromPlistName:@"NotifierSettings" target:self] retain];
    }
    return _specifiers;
}
@end

// vim:ft=objc

由于我没有标题,我必须声明我将使用的标题。但是我在上面做错了。我应该将 _specifiers 和我的 PSListController 子类的所有方法放在 PSListController 本身中,而不是放在我的子类中。

于 2013-05-15T21:02:04.847 回答