This is what the plist looks like as source code:
{
authorLastName = Doe;
authorFirstName = Jane;
imageFilePath = "NoImage.png";
title = "Account Test 1";
year = 2009;
},
{
authorLastName = Doe;
authorFirstName = John;
imageFilePath = "NoImage.png";
title = "Account Test 2";
year = 2009;
},
How come it isnt in XML format???
I want to count the total items of a plist, and display them like: '4 Accounts'.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *myPlistPath = [documentsDirectory
stringByAppendingPathComponent:@"Accounts.plist"];
NSDictionary *plistDict = [[NSDictionary alloc] initWithContentsOfFile:myPlistPath];
NSArray *array = [[plistDict objectForKey:0]
sortedArrayUsingSelector:@selector(compare:)];
return([NSString stringWithFormat:@"%d Accounts", [array count]]);
However, the result returns 0. I want it to return the ammount of items in the dictionary.