Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how TRUEPREDICATE differ from [NSPredicate predicateWithValue:YES]?

Tags:

core-data

I am using [fetchRequest setPredicate:[NSPredicate predicateWithValue:YES]]; to debug my code to by pass universal true predicate. When I exicuting lldb command po [NSPredicate predicateWithValue:YES], it print TRUEPREDICATE.

The return type for predicateWithValue: is NSPredicate.

When I changed it to [fetchRequest setPredicate:TRUEPREDICATE]; Xcode complain a syntax error "use of un-declared identifier"

My question is should I have to import any header file to remove error? If not then how TRUEPREDICATE differ from [NSPredicate predicateWithValue:YES].

like image 839
kaushal Avatar asked Jun 08 '16 12:06

kaushal


1 Answers

A universal true predicate can be created with

[NSPredicate predicateWithValue:YES];

or

[NSPredicate predicateWithFormat:@"TRUEPREDICATE"];

Both statements return the same predicate.

po prints the description of an object. The description of NSPredicate is similar to the format.

like image 135
Willeke Avatar answered Oct 17 '22 04:10

Willeke