views:

21

answers:

1

How can i check whether is a plist is empty?

+1  A: 

If your plist is an array:

NSArray *array = [[NSArray alloc] initWithContentsOfFile:yourFile];
if ([array count] == 0) {
    NSLog(@"Your plist is empty");
}

Or if your plist is a dictionary:

NSDictionary *dictionary = [[NSDictionary alloc] initWithContentsOfFile:yourFile];
if ([[dictionary allKeys] count] == 0) {
    NSLog(@"Your plist is empty");
}
Tim van Elsloo
thks for your help
Stefan