Solving plist ‘Invalid Summary’ error
If you are doing something like the following:
NSString *path = [[NSBundle mainBundle] pathForResource:@”MenuStructure” ofType:@”plist”];
self.menuItems = [NSArray arrayWithContentsOfFile:path];
and run into problems resulting in an empty array which upon examination using breakpoints shows ‘Invalid Array’. U should check the following:
1. That the path is correct. if u use NSLog to print the path to the console or use the contextual info from the path then you will be told were your app is located. This would work best using they simulator because you will actually be able to navigate to the files. If you are running this on the device, you will be able to download the app directory however it removes the bundle directory (The folder with the executable and plists that you want to inspect!).
Doing this is especially useful if you suspect that locali(s/z)ation may the source of your woes. When doing this I realised that the localisation files/folders that I thought I’d removed via the minus option in xcode were still present. I found also that by cleaning the project (product>clean or Shift+CMD+K) that these unwanted files and folders were removed to reflect the correct layout.
2. The most likely cause is that the plist is not arranged in the format that you accessing it in. I.E it is laid out as a dictionary and you are using code like the above to move contents into an array (this may happen in reverse also). To check, right click the plist in the navigation pane and select open as>Source Code to view the XML.
If it reads:
<?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>sectionChildren</key>
<array></array> or <dict></dict>
…
</dict>
</plist>
Then the plists root object is a dictionary and is the reason for the error. Just change this to an array by removing the keys and changing the outermost <dict> and </dict> to <array> and </array>. I’m not sure and haven’t tested if this error would also occur if the root object was a string, number, or date etc.
…
</dict>
change the









Leave your response!