我面臨着使用predicateWithFormat方法創建NSPredicate類型對象的問題。用於電子郵件問題的NSPredicate predicateWithFormat
AppDelegate *appdelegateObj = (AppDelegate *)[[UIApplication sharedApplication] delegate];
self.managedObjectContext = [appdelegateObj managedObjectContext];
NSString *emailWithBackslashedAtTheRate = [email stringByReplacingOccurrencesOfString:@"@" withString:@"\\@"];
NSFetchRequest *fetchRequestObj = [NSFetchRequest fetchRequestWithEntityName:@"Usertable"];
NSMutableArray *dataList;
**NSPredicate *predicate = [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"email CONTAINS[c] %@",emailWithBackslashedAtTheRate]];**
[fetchRequestObj setPredicate:predicate];
@synchronized(delegate.persistentStoreCoordinator) {
NSError *error = nil;
NSMutableArray *filteredUser = (NSMutableArray *)[self.managedObjectContext executeFetchRequest:fetchRequestObj error:&error];
}
任何人都可以解釋,什麼是問題?
是什麼通過調用'executeFetchRequest'返回的'error'? –
emailWithBackslashedAtTheRate的格式是什麼?實體中的電子郵件屬性名稱是什麼? –
你能記錄什麼是問題? –