出于某种原因,我没有从我的 plist 中获得价值,我不确定为什么这里是 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>
我的方法是:
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];
应该发生的事情是,我的方法将获取当前应用程序的显示 ID,然后从 plist 中获取应用程序的值,然后拆分值字符串并从数组中生成 UIColor。因此,如果我打开 AppStore,它将搜索 plist 并返回“0.28824,0.37059,0.48235”并将其设置为颜色,但它似乎没有返回任何内容,我已经测试了 displayIdentifier,这是正确的显示正确的应用程序显示 ID,我只是不知道为什么它没有获得价值