2013-02-11 93 views
-1

此代码nspredicate与GROUPBY不喜欢谓词的NSDate比较

瑶池
predicate = [NSPredicate predicateWithFormat:@" (perHourStat.originator.company == %@)",selected]; 

对象:

> Printing description of fetchedObjects: <_PFArray 0x100664fb0>(
> <PerHourStat: 0x1> (entity: PerHourStat; id: 0x10122f310 
> <x-coredata://BBDDF3D7-EA50-4290-B03A-05349E74467E/PerHourStat/p1> ; 
> data: { 
>  acd = "0.03688591122627258"; 
>  allCalls = 3; 
>  asr = 1; 
>  cost = "0.1327892804145813"; 
>  dateFrom = "2013-02-11 21:00:00 +0000"; 
>  dateTo = "2013-02-11 21:59:59 +0000"; 
>  duration = "6.639464020729065"; 
>  income = "0.1991839206218719"; 
>  originator = "0x1<x-coredata://BBDDF3D7-EA50-4290-B03A-05349E74467E/Originator/p1>"; 
>  perDestinationsStat = "<relationship fault: 0x104d2b9b0 'perDestinationsStat'>"; 
>  succesefulCalls = 3; 
>  terminator = nil; }) 

从/到匹配dateFrom在finder对象中:

> description of from: 2013-02-11 22:00:00 +0000 
> description of to: 2013-02-12 21:59:59 +0000 
+1

它看起来像你的日期比较*应*失败,这将解释为什么没有找到对象。 – 2013-02-11 22:43:24

回答

1

您正在比较同一日期21:00>22:00。这将明显匹配0条记录。