novicePrgrmr
novicePrgrmr

Reputation: 19385

Error reading plist: stream had too few bytes, format: -1073751400

I'm trying to read some data out of a plist and I'm getting this error: "Error reading plist: stream had too few bytes, format: -1073751400"

Any help would be much appreciated.

code:

// read property list into memory as an NSData object
    NSData *plistXML = [[NSFileManager defaultManager] contentsAtPath:plistPath];
    NSString *errorDesc = nil;
    NSPropertyListFormat format;
    // convert static property liost into dictionary object
    NSDictionary *temp = (NSDictionary *)[NSPropertyListSerialization propertyListFromData:plistXML mutabilityOption:NSPropertyListMutableContainersAndLeaves format:&format errorDescription:&errorDesc];
    if (!temp)
    {
        NSLog(@"Error reading plist: %@, format: %d", errorDesc, format);
    }
    // assign values
    self.excersizesArray = [NSMutableArray arrayWithArray:[temp objectForKey:@"Excersizes"]];

Here's the plist:

enter image description here

Upvotes: 0

Views: 1994

Answers (1)

Bouncing Bit
Bouncing Bit

Reputation: 358

I might be mistaken, but doesn't the "Excersizes" array has to be wrapped within an dictionary itself?

That is you have to put a dictionary tag around your "Excersizes" array like this:

<dict>
 <key>Excersizes</key>
 <array>
 ...
 </array>
</dict>

At least your use of

self.excersizesArray = [NSMutableArray arrayWithArray:[temp objectForKey:@"Excersizes"]];

points towards this solution. This might fix your parsing error as well...

Upvotes: 1

Related Questions