Question

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.

Était-ce utile?

La solution

I figured it out.

The problem was with the preferences .mm file. Compare the one I put in my question with this one:

@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

Since I don't have headers I have to declare the ones I will use. But I did it wrong up there. I'm supposed to put _specifiers and all the methods of my PSListController subclass in PSListController itself, not in my subclass.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top