我正在尝试过滤一个array
with NSPredicate
,但它总是返回一个empty array
.
代码:
_contentFilteredArray = [_contentArray mutableCopy];
[_contentFilteredArray filterUsingPredicate:[NSPredicate predicateWithFormat:@"special == 1"]]; // Always return an empty array.
原始_contentArray:
(
{
id = 1;
special = 0;
},
{
id = 2;
special = 1;
},
{
id = 3;
special = 1;
},
{
id = 4;
special = 0;
}
)
我对 _contentFilteredArray 的期望:
(
{
id = 2;
special = 1;
},
{
id = 3;
special = 1;
},
)