Is there any way to use an XOR as an operator for an predicate.
I have a File object and I want to know if there is a file available in english. If it’s not available in english, it should return me the german version. If both are available it should not return the german version. This is why I need an XOR.
Example:
[NSPredicate predicateWithFormat:@"file.language = 'en' XOR file.language = 'de'"];
This will return only the english file.
As per http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/Predicates/Articles/pSyntax.html#//apple_ref/doc/uid/TP40001795-SW1 there does not seem to be such an operator. If needed you would have to use parantheses and convert a XOR b to (a AND NOT b) OR (NOT a and b). In any case, note Henning’s comment about this not helping anyway. One problem in your statement is that it is not balanced, i.e. you want to have the english version to have precedence. The most simplest way would probably be to
file.language = 'en'file.language = 'de'This way you can ensure the precedence of the english file.