I studied this topic and found some differences in the plist file.
For example, I have a plist source file in sample code that is read using the method
NSArray *array = [[NSArray alloc] initWithContentsOfFile:path];
xml source file:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <array> <dict> <key>nameKey</key> <string>Number One</string> <key>imageKey</key> <string>small_one.png</string> </dict> <dict> <key>nameKey</key> <string>Number Two</string> <key>imageKey</key> <string>small_two.png</string> </dict> </array> </plist>
When I tried to create the same file above in the Xcode interface using Add a new list of file properties, and after editing the placement of the element, the same path is displayed in the interface for the file above, [[NSArray alloc] initWithContentsOfFile:path]; fails, and I found a problem in the structure of the xml plist file. A file created using the Xcode interface results in an xml plist file:
<plist version="1.0"> <dict> <key>item 0</key> <dict> <key>imageKey</key> <string>image1.jpg</string> </dict> <key>item 1</key> <dict> <key>imageKey</key> <string>image2.jpg</string> </dict> </dict> </plist>
I fixed the change directly in the xml file as the same first example, and the method works fine.
Point in the Xcode interface for the plist file, you do not see these differences. Both look the same. Maybe my Xcode 4.1
source share