Note that there are some explanatory texts on larger screens.

plurals
  1. POread multi-array from plist
    primarykey
    data
    text
    <p>I can't get it work to have the 8 items from the plist below. I have a plist "settings.plist". Now I wan't from vragen -> category <code>(self.catagorie - 1)</code> -> question. The 8 items. But the array keeps empty. </p> <p>What am I doing wrong?</p> <p>Code:</p> <pre><code>NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory stringByAppendingPathComponent:@"instellingen.plist"]; NSMutableDictionary *instellingen = [NSMutableDictionary dictionaryWithContentsOfFile:path]; NSArray *vragen = [instellingen objectForKey:@"vragen"]; NSArray *cata = [vragen objectAtIndex: (self.catagorie-1)]; NSArray *question = [cata objectAtIndex: 0]; NSLog(@"count: %i", [question count]); </code></pre> <p>Plist file:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; &lt;plist version="1.0"&gt; &lt;dict&gt; &lt;key&gt;vragen&lt;/key&gt; &lt;array&gt; &lt;array&gt; &lt;--catagorydata &lt;array&gt; &lt;-- questiondata &lt;string&gt;vraag&lt;/string&gt; &lt;string&gt;A&lt;/string&gt; &lt;string&gt;B&lt;/string&gt; &lt;string&gt;C&lt;/string&gt; &lt;string&gt;D&lt;/string&gt; &lt;string&gt;1&lt;/string&gt; &lt;string&gt;standaard&lt;/string&gt; &lt;string&gt;&lt;/string&gt; &lt;/array&gt; &lt;array&gt; &lt;string&gt;vraag2&lt;/string&gt; &lt;string&gt;A&lt;/string&gt; &lt;string&gt;B&lt;/string&gt; &lt;string&gt;C&lt;/string&gt; &lt;string&gt;D&lt;/string&gt; &lt;string&gt;1&lt;/string&gt; &lt;string&gt;afbeelding&lt;/string&gt; &lt;string&gt;afbeelding.jpg&lt;/string&gt; &lt;/array&gt; &lt;/array&gt; &lt;/array&gt; &lt;key&gt;firstBoot&lt;/key&gt; &lt;true/&gt; &lt;key&gt;regelAtRuntime&lt;/key&gt; &lt;true/&gt; &lt;/dict&gt; &lt;/plist&gt; </code></pre>
    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.
 

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