将嵌套的字典键添加到 plist

Adding nested dict key to plist

我正在尝试将这些键添加到 plist 的根目录中:

<dict>
  <key>11</key>
    <dict>
      <key>FeatureLockdown</key>
        <dict>
          <key>bUpdater</key>
          <false/>
        </dict>
    </dict>
</dict>

我试过使用 PlistBuddy 和默认值。我似乎无法让它工作。

有谁知道通过终端正确格式化它的方法吗?

我可以通过查看 man page for PlistBuddy 并在终端中进行操作来做到这一点:

/usr/libexec/PlistBuddy -c "Add :11 dict" Info.plist
/usr/libexec/PlistBuddy -c "Add :11:FeatureLockdown dict" Info.plist
/usr/libexec/PlistBuddy -c "Add :11:FeatureLockdown:bUpdater bool false" Info.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>11</key>
    <dict>
        <key>FeatureLockdown</key>
        <dict>
           <key>bUpdater</key>
           <false/>
        </dict>
    </dict>
...
...
...