iphone - 如何检查plist是否为空

标签 iphone xcode plist

如何检查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/

相关文章:

iphone - 如何使用imageview在iphone中显示相册照片

ios - ScrollView swift 3 中的垂直对齐图像

ios - 嵌套设置页面在 iOS13 中崩溃

iphone - Objective-C:查找字符串中的辅音

ios - UITableViewCell 内的 UIView 转换不起作用

iphone - 获取文档目录内容时无法省略 @".DS_Store"文件

ios - 安装应用程序时,请在选项字典中包含 kCFBundleIdentifierKey

ios - 编译问题 : Incompatibility of Swift versions between two packages

plist - 错误 ITMS-90075 : The application-identifier entitlement is missing

ios - Swift - 管理静态字符串和常量(如 URL、ID、图像名称等)的最佳方法是什么