iPhone – Core Data NSPredicate and SQLITE Store

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];

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1097 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.