iphone - Core Data NSPredicate with SQLITE store -
this code returns 0 objects not correct. however, when removing predicate, fetch request returns objects.
nserror *error = nil; nsentitydescription *entitydescription = [nsentitydescription entityforname:@"person" inmanagedobjectcontext:[self managedobjectcontext]]; nspredicate * pr = [nspredicate predicatewithformat:@"%k beginswith '%@' ", @"fullname", searchtext]; //nspredicate * pr = [nspredicate predicatewithformat:@"personid == %@", searchtext]; works fine nsfetchrequest *request = [[[nsfetchrequest alloc] init] autorelease]; [request setentity:entitydescription]; [request setpredicate:pr]; nsarray * arr = [[self managedobjectcontext] executefetchrequest:request error:&error];
the fullname attribute contains unicode data(arabic).
any appreciated.
try:
nspredicate * pr = [nspredicate predicatewithformat:@"fullname beginswith %@", searchtext];
Comments
Post a Comment