Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7020659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:20:48+00:00 2026-05-27T23:20:48+00:00

I have a strange problem that probably has a simple solution that I just

  • 0

I have a strange problem that probably has a simple solution that I just can’t find/figure out. Any ideas are greatly appreciated.

I have a property list that consists of an array as the root object. The array contains a couple dictionaries.

The code below shows how I’m attempting to load the plist data into my array-

-(void)awakeFromNib{

    NSString *plistPath = @"/Users/administrator/Desktop/WipeOut Winner!/Data.plist";
    NSLog(@"Plist path is %@",plistPath);


    if (![[NSFileManager defaultManager] fileExistsAtPath:plistPath]) {
            NSLog(@"File wasn't found");
    }


    tableDataArray = [[NSMutableArray alloc]initWithContentsOfFile:plistPath];

    NSLog(@"array count is %lu",[tableDataArray count]);   

}

And below is the plist file-

<?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>root</key>
    <array>
        <dict>
            <key>winner</key>
            <string>Scott</string>
            <key>personChosen</key>
            <string>Female</string>
            <key>winType</key>
            <string>2 and &apos;Won&apos; -3 pts.</string>
            <key>Points</key>
            <string>3</string>
        </dict>
        <dict>
            <key>winner</key>
            <string>Emily</string>
            <key>personChosen</key>
            <string>Male</string>
            <key>winType</key>
            <string>All The Way! -5 pts.</string>
            <key>points</key>
            <string>5</string>
        </dict>
    </array>
</dict>
</plist>

The plist file is being found as it should be. And I have confirmed that my root object in the plist is an array (of dictionaries). My array count after this call always turns up zero though.

During the process of trying to figure it out, I changed the data in my plist to a single NSDictionary instead of an array containing dictionaries. Then I loaded the plist into an NSDictionary, loaded that dictionary into the array, and the array count was 1 as expected, so I know for sure that things are hooked up correctly as far as finding, loading, etc. of the plist goes. In another test, rather than trying to load the array with the plist data like below

tableDataArray = [[NSMutableArray alloc]initWithContentsOfFile:plistPath];

I bypassed the plist stuff all together and just loaded the array like so-

tableDataArray =[[NSMutableArray alloc]initWithCapacity:1];

NSDictionary *dict = [[NSDictionary alloc]initWithObjectsAndKeys:@"Emily",@"name",@"12",@"age", nil];

[tableDataArray addObject:dict];

and that also changed the array count to one as expected. So I’m thinking my problem has to be something to do with this

tableDataArray = [[NSMutableArray alloc]initWithContentsOfFile:plistPath];

but I can’t seem to figure out where.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:20:49+00:00Added an answer on May 27, 2026 at 11:20 pm

    The root of your plist isn’t an array. It is a dictionary with a single key “root” that points to an array of dictionaries. Your plist should instead look like:

    <?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">
    <array>
        <dict>
            <key>winner</key>
            <string>Scott</string>
            <key>personChosen</key>
            <string>Female</string>
            <key>winType</key>
            <string>2 and &apos;Won&apos; -3 pts.</string>
            <key>Points</key>
            <string>3</string>
        </dict>
        <dict>
            <key>winner</key>
            <string>Emily</string>
            <key>personChosen</key>
            <string>Male</string>
            <key>winType</key>
            <string>All The Way! -5 pts.</string>
            <key>points</key>
            <string>5</string>
        </dict>
    </array>
    </plist>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a strange problem which probably has a very simple solution, I just
I have a strange problem that I can't figure out when trying to do
I'm having a strange problem here... I have an ASP.NET 3.5 application that has
Strange and probably trivial problem. I have three projects in one solution (.NET 2.0,
I have a a strange problem that I can't seem to identify the cause
I have a strange problem that I think has to do with routes. In
I have a strange problem that is only happening in a single location. I
I have a strange problem that I could not solve. When I try to
I'm having a strange problem in that I have php inserting text into a
I have a strange problem with mod_rewrite, the rules that are relevant here are:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.