如何检查plist是否为空?
最佳答案
如果你的 plist 是一个数组:
NSArray *array = [[NSArray alloc] initWithContentsOfFile:yourFile];
if ([array count] == 0) {
NSLog(@"Your plist is empty");
}
或者如果您的 plist 是字典:
NSDictionary *dictionary = [[NSDictionary alloc] initWithContentsOfFile:yourFile];
if ([[dictionary allKeys] count] == 0) {
NSLog(@"Your plist is empty");
}
关于iphone - 如何检查plist是否为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3541377/