2

私はここに新しいです。誰かが私を助けてくれることを願っています!

私は AppList (Ryan Petrich) を追加して動作させる微調整を作成しているので、すべてのアプリケーションと各アプリのオン/オフを切り替えるリンクセルを優先的にバンドルしています。

それらのいくつかをオンにすると、a<key>ALvalue-com.some.app</key>と a の値<true/>が設定の .plist に保存されます。

「key」「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 ファイルでこのアクションを使用して環境設定バンドルにボタンを追加するには (うまくいきません):

- (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];
    }
}

設定バンドル .plist を使用するか、2 つ目のバンドルを使用して必要な方法でそれらの行をコピーする場合、私にとっては関係ありません。

4

1 に答える 1

0

このような。

  1. 新しい .plist ファイルを作成し、プロパティ リストとして開きます。

  2. + をクリックして、情報プロパティ リスト内に新しいプロパティを作成します。

  3. プロパティに名前を付けます。たとえば、「テキスト」はタイプを「配列」に設定します。

  4. 上記で作成した配列内に新しい項目を追加し、項目ごとにテキストを入力します。

  5. ビューコントローラークラスで、これを行う必要があります。

        //ViewController.h
    
        @property (nonatomic,strong)NSArray *plistDataArr;
    
       //ViewController.m
    
    
     -(NSArray*) plistDataArr
      {
        if(! _plistDataArr)
        {
          NSString *filePath = [[NSBundle mainBundle]pathForResource:@"YOUR Plist file name" ofType:@"plist"];
         _plistDataArr = [NSArray arrayWithContentsOfFile:filePath];
        }
      return _plistDataArr;
    
       }
    
      //viewDidLoad
    
      NSMutableArray *tempArr=[NSMutableArray arrayWithArray:self. _plistDataArr];
    
于 2016-04-13T05:08:14.913 に答える