ここは新しいです。誰かが私を助けることを願っています!.plistファイルの配列内に文字列を書き込む方法
私はAppList(Ryan Petrich)を追加して動作させているので、すべてのアプリケーションとスイッチオン/オフで、各アプリケーションのlinkcellを好みの状態でバンドルしています。
一部をオンにすると、<key>ALvalue-com.some.app</key>
と値<true/>
が環境設定.plistに保存されます。
私はこのようになり、「キー」「BOOLVALUE」の構造を変更する方法を把握しようとしている:
AL-hd.plistファイル
<dict>
<key>AL-hd</key>
<array>
<string>com.apple.AppStore</string>
<string>com.apple.gamecenter</string>
<string>com.apple.stocks</string>
</array>
</dict>
</plist>
の代わりに、この
<dict>
<key>ALvalue-com.apple.AppStore</key>
<true/>
<key>ALvalue-com.apple.gamecenter</key>
<true/>
<key>ALvalue-com.apple.stocks</key>
<true/>
</dict>
</plist>
これは、設定ファイルAL-hd.plistを節約し、私のAPPLISTのの.plistです:
<dict>
<key>cell</key>
<string>PSLinkCell</string>
<key>bundle</key>
<string>AppList</string>
<key>isController</key>
<string>1</string>
<key>label</key>
<string>Show apps</string>
<key>icon</key>
<string>Favorites.png</string>
<key>ALAllowsSelection</key>
<string>1</string>
<key>ALChangeNotification</key>
<string>com.your.companyChanged</string>
<key>ALSectionDescriptors</key>
<array>
<dict>
<key>footer-title</key>
<string>Check what apps you want to show up</string>
<key>items</key>
<array/>
</dict>
<dict>
<key>cell-class-name</key>
<string>ALCheckCell</string>
<key>icon-size</key>
<string>29</string>
<key>suppress-hidden-apps</key>
<string>1</string>
<key>title</key>
<string>All Applications</string>
</dict>
</array>
<key>ALSettingsKeyPrefix</key>
<string>ALvalue-</string>
<key>ALSettingsPath</key>
<string>/var/mobile/Library/Preferences/AL-hd.plist</string>
</dict>
私はたくさんのものを探し、何百ものものを試します。
ありがとうございます!
私が試した1つのことは、2番目の.plistを作成し、後でそのキーをコピーして2番目のファイルに文字列のように貼り付けることでした。そして、(運を持つ).mmファイルにこのアクションで好みのバンドルにボタンを追加するには:私は好みバンドルの.plistを使用するか、または第二いずれかを使用して、コピーした場合、私のために
- (void)save
{
NSString *bundleID = [[NSBundle mainBundle] bundleIdentifier];
// Either this or whatever works from link after this
NSString *prefPath = @"/User/Library/Preferences/com.your.company.plist";
NSString *showPath = @"/User/Library/Preferences/AL-hd.plist";
NSMutableDictionary *plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:prefPath];
NSMutableArray *show = [[NSMutableArray alloc] initWithContentsOfFile:showPath];
if ([[plistDict objectForKey:bundleID] boolValue]) {
[Show addObject:bundleID];
}
}
は関係ありません私が必要とするような行。
あなたの問題が何であるかは不明です。コードを表示し、必要なものとは異なる仕組みを説明する必要があります。次に、誰かがあなたを助けるかもしれません。質問自体を編集し、コメントに資料を追加しないでください。 – CRD
2つのplistファイルを1つにマージしたいですか? – phi
いいえ、私はより明確に答えを編集しています...私の英語で申し訳ありません! – Olivier