Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.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
Iphone 如何使用“创建同时包含两个”的复合谓词;或;及;及;_Iphone_Ios - Fatal编程技术网

Iphone 如何使用“创建同时包含两个”的复合谓词;或;及;及;

Iphone 如何使用“创建同时包含两个”的复合谓词;或;及;及;,iphone,ios,Iphone,Ios,我获取了以下3个类别,但希望添加一个“AND”谓词以缩小结果范围,其中“mark”处于启用状态 //我想这样做: NSPredicate *finalPredicate = [compoundPredicate && markPredicate]; [fetchRequest setPredicate:finalPredicate]; 这就是你要找的吗 NSPredicate *finalPredicate = [NSCompoundPredicate andPredica

我获取了以下3个类别,但希望添加一个“AND”谓词以缩小结果范围,其中“mark”处于启用状态


//我想这样做:

NSPredicate *finalPredicate = [compoundPredicate && markPredicate];

[fetchRequest setPredicate:finalPredicate];

这就是你要找的吗

NSPredicate *finalPredicate = [NSCompoundPredicate andPredicateWithSubpredicates:
         [NSArray arrayWithObjects:compoundPredicate, markPredicate, nil]];
或者,对容器文本使用“modern Objective-C”语法:

NSPredicate *finalPredicate = [NSCompoundPredicate andPredicateWithSubpredicates:
                                     @[compoundPredicate, markPredicate]];
NSPredicate *finalPredicate = [NSCompoundPredicate andPredicateWithSubpredicates:
         [NSArray arrayWithObjects:compoundPredicate, markPredicate, nil]];
NSPredicate *finalPredicate = [NSCompoundPredicate andPredicateWithSubpredicates:
                                     @[compoundPredicate, markPredicate]];