开发者

Is having a NSFetchRequest with an NSPredicate supported in MonoTouch

开发者 https://www.devze.com 2023-04-13 09:18 出处:网络
I have tried the following using an NSPredicate and am not getting the results I would expect: NSFetchRequest request = new NSFetchRequest ();

I have tried the following using an NSPredicate and am not getting the results I would expect:

NSFetchRequest request = new NSFetchRequest ();
request.Entity = NSEntityDescription.EntityForName("Entity", managedObjectContext);

NSSortDescriptor sort = new NSSortDescriptor ("date", false);
request.SortDescriptors = new NSSortDescriptor[1] { sort开发者_如何学Python };
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?


wow, You're really saving lines of programming here. It is hard to tell with that snippet, but... My best suggestion is to break those lines into more lines, like

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

And keep going like that line by line to make sure you're getting the right feedback. That's what I do. Might help a little

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号