Search code examples
iphoneios5theos

method not getting value from plist


For some reason I'm not getting the value from my plist and I'm not sure why here is the 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>CachedColors</key>
    <dict>
        <key>com.Halfbrick.Fruit</key>
        <string>0.00000,0.00000,0.00000</string>
        <key>com.amazon.Amazon</key>
        <string>0.00000,0.00000,0.00000</string>
        <key>com.apple.AdSheetPhone</key>
        <string>0.00000,0.00000,0.00000</string>
        <key>com.apple.AppStore</key>
        <string>0.28824,0.37059,0.48235</string>
    <key>default</key>
    <true/>
    <key>gradient</key>
    <false/>
    <key>opaque</key>
    <true/>
    <key>showedMessage</key>
    <true/>
    <key>translucent</key>
    <true/>
</dict>
</plist>

and my method is:

SBApplication *frontApp = [(SpringBoard*)[UIApplication sharedApplication] _accessibilityFrontMostApplication];
NSString *frontAppBundleID = [frontApp displayIdentifier];
NSDictionary *statusBarCachedColors = [NSDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/cc.tweak.statuscolor.plist"];
NSString *colorString = (NSString*)[statusBarCachedColors objectForKey:frontAppBundleID];
NSArray *components = [colorString componentsSeparatedByString:@","];
UIColor *tintColor = [UIColor colorWithRed:[[components objectAtIndex:0] floatValue] green:[[components objectAtIndex:1] floatValue] blue:[[components objectAtIndex:2] floatValue] alpha:1];

whats supposed to happen is, my method would get the Display ID for the current application, then get the value for the app from the plist, then split the value string and make a UIColor from the array. so if I opened the AppStore, it would search the plist and return "0.28824,0.37059,0.48235" and make that into the color, but it doesn't seem to return anything, I've tested the displayIdentifier and that is correct it does display the correct app display id, i just don't know why it isn't getting a value


Solution

  • You miss the item CachedColors.

    NSString *colorString = (NSString*)[[statusBarCachedColors objectForKey:@"CachedColors"] objectForKey:frontAppBundleID];