This code returns 0 incorrect objects. However, when the predicate is deleted, the get request will return all 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 help is appreciated.
try:
NSPredicate * pr = [NSPredicate predica teWithFormat:@"FullName beginswith %@", searchText];
This code returns 0 incorrect objects. However, when the predicate is deleted, the get request will return all 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 help is appreciated.
Try:
< p>
NSPredicate * pr = [NSPredicate predicateWithFormat: @"FullName beginswith %@", searchText];