Note that there are some explanatory texts on larger screens.

plurals
  1. POtransforming a plist in another nsdictionary
    primarykey
    data
    text
    <p>I'm not english, new to objective c and new to this website. But i hope you will understand my problem. I tried to use the search engine but i couldn't find a answer...</p> <p>THE PROBLEM: i have a plist file like this</p> <pre><code>&lt;plist version="1.0"&gt; &lt;array&gt; &lt;dict&gt; &lt;key&gt;ID&lt;/key&gt; &lt;string&gt;001&lt;/string&gt; &lt;key&gt;CAT&lt;/key&gt; &lt;string&gt;A&lt;/string&gt; &lt;key&gt;TITLE&lt;/key&gt; &lt;string&gt;AAAA01&lt;/string&gt; &lt;/dict&gt; &lt;dict&gt; &lt;key&gt;ID&lt;/key&gt; &lt;string&gt;002&lt;/string&gt; &lt;key&gt;CAT&lt;/key&gt; &lt;string&gt;A&lt;/string&gt; &lt;key&gt;TITLE&lt;/key&gt; &lt;string&gt;AAAA02&lt;/string&gt; &lt;/dict&gt; &lt;dict&gt; &lt;key&gt;ID&lt;/key&gt; &lt;string&gt;003&lt;/string&gt; &lt;key&gt;CAT&lt;/key&gt; &lt;string&gt;B&lt;/string&gt; &lt;key&gt;TITLE&lt;/key&gt; &lt;string&gt;BBBB01&lt;/string&gt; &lt;/dict&gt; ..... &lt;/array&gt; &lt;/plist&gt; </code></pre> <p>so i have many entries like this. every entry has a category (CAT) like in my example "A" and "B". now i need a code to transform this to the following:</p> <pre><code>NSArray NSDictionary CAT =&gt; "A" VALUES =&gt; {"AAAA01","AAAA02"} NSDictionary CAT =&gt; "B" VALUES =&gt; {"BBBB01", ...} ETC. </code></pre> <p>MY SOLUTION:</p> <p>i get the plist with the following code</p> <pre><code>NSString *path = [[NSBundle mainBundle] pathForResource:@"Dictonary" ofType:@"plist"]; arrayIndex = [[NSArray alloc] initWithContentsOfFile:path]; </code></pre> <p>Now i have everything saved in the arrayIndex but then i dont find a way to transform the code in a new array to get my wanted result.</p> <p>please can anybody help me?</p> <p>THANK YOU very much!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload