Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在iOS中从Plist检测keyType Boolean或not_Ios_Iphone_Plist - Fatal编程技术网

如何在iOS中从Plist检测keyType Boolean或not

如何在iOS中从Plist检测keyType Boolean或not,ios,iphone,plist,Ios,Iphone,Plist,我有一个要求,我想检测特定键的值在plist中是否为Boolean类型。使用以下代码,我正在从bundle加载plist: NSString *filePath = [[NSBundle mainBundle] pathForResource:@"myPlist" ofType:@"plist"]; NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:filePath]; id developer = [dict o

我有一个要求,我想检测特定键的值在plist中是否为Boolean类型。使用以下代码,我正在从bundle加载plist:

NSString *filePath = [[NSBundle mainBundle] pathForResource:@"myPlist" ofType:@"plist"];
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:filePath];
id developer = [dict objectForKey:@“iOSDeveloper];
我的plist看起来像这样:

   Key                       Type                             value
iosDeveloper                Boolean                            YES

如果用户将类型更改为NSNumber、NSArray、NSDictionary等,而不是Boolean,我想打印类似于日志的select type Boolean for iOSDeveloper key

Boolean是另一个名称的NSNumber。您试图检测数组/字典的内容是什么?如果[developer iskindof class[NSNumber class]],我会这样做。这里的问题是如果我选择类型NSArray,NSDictionary。。。。它为iOSDeveloper键打印类似日志的选择类型布尔值。如果我选择类型NSNumber,它不会给我日志。您最好允许NSNumber,但检查值是否为0或1,如果不是,则记录。。。