Has NSFetchRequest with NSPredicate supported in MonoTouch

I tried using NSPredicate and do not get the expected results:

NSFetchRequest request = new NSFetchRequest (); request.Entity = NSEntityDescription.EntityForName("Entity", managedObjectContext); NSSortDescriptor sort = new NSSortDescriptor ("date", false); request.SortDescriptors = new NSSortDescriptor[1] { sort }; request.Predicate = NSPredicate.FromFormat("stringProperty == %@", new NSObject[1]{new NSString("someString")}); error = null; NSObject[] results = managedObjectContext.ExecuteFetchRequest (request, out error); 

Is NSPredicate supported in the current stable version of MonoTouch (5.0) or am I doing something wrong?

+6
source share
1 answer

wow, you really save programming programs here. It's hard to say with this snippet, but ... My best suggestion is to split these lines into several lines, for example

 NSPredicate *myPredicate = ... if (myPredicate) { NSLog (@"Predicate exists"); } 

And keep going so that line by line to make sure you get the right feedback. This is what I do. May help a little

0
source

Source: https://habr.com/ru/post/899249/


All Articles