// // channelListMethodModel.m // ThePaperBase // // Created by scar1900 on 15/7/30. // Copyright (c) 2015年 scar1900. All rights reserved. // #import "channelListMethodModel.h" @implementation channelListMethodModel + (BOOL)checkIsHaveRead:(NSString*)contId { BOOL isRead = NO; NSError *error; NSFetchRequest *request = [[NSFetchRequest alloc]init]; //为已创建好的实体利用检索到的上下文创建一个实体描述 NSEntityDescription *entityDescription = [NSEntityDescription entityForName:@"HaveReadContentList" inManagedObjectContext:[CoreDataManager shareInstance].managedObjectContext]; [request setEntity:entityDescription]; //确定持久库中是否存在与此字段相对应的托管对象,所以穿件一个谓词来确定字段的正确对象: NSPredicate *pred = [NSPredicate predicateWithFormat:@"contId == %@",contId]; [request setPredicate:pred]; NSArray *objs = [[CoreDataManager shareInstance].managedObjectContext executeFetchRequest:request error:&error]; if (objs == nil) { TPLOG(@"there was an error!!"); } if (objs.count > 0) { isRead = YES; }else isRead = NO; return isRead; } @end