0
好吧,我想我的更新調整束到NSMutableArray
,valididentifiers如果用戶選擇的偏好束內的Safari瀏覽器的應用程序爲我的調整,其填充有選擇的應用程序標識符,比如com.apple.mobilesafari
用戶的價值。不過,我現在試圖更新plist計數支持的捆綁與代碼波紋管,但它只檢測篩選器密鑰當我想更新到捆綁密鑰。我知道它只是通過記錄bundlesplist
allKeys
屬性來檢測篩選器作爲有效密鑰,並在syslog中觀察。如何更新Plist文件?
所以我的問題是我如何專門更新plist中的Bundles
部分所示的波紋管?
test.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>Filter</key>
<dict>
<key>Bundles</key>
<array>
<string>com.apple.mobilesafari</string>
<string>com.apple.springboard</string>
</array>
</dict>
</dict>
</plist>
我的代碼:
NSMutableDictionary *bundlesplist = [NSMutableDictionary dictionaryWithContentsOfFile:@"/Library/MobileSubstrate/DynamicLibraries/test.plist"];
NSLog(@"%@", bundlesplist);
NSLog(@"%@", [bundlesplist allKeys]);
[bundlesplist setObject:valididentifiers forKey:@"Bundles"];
[bundlesplist writeToFile:@"/Library/MobileSubstrate/DynamicLibraries/test.plist" atomically:NO];
系統日誌輸出對於allKeys
2017-07-18 20:25:28.627: (
Filter
)
我不確定我是否會以這種錯誤的方式去做,或者只是很愚蠢,但任何幫助都將不勝感激。 非常感謝湯姆
乾杯,你推薦偉大的工作! – Tom