【发布时间】:2015-08-11 23:22:04
【问题描述】:
从服务器收集数据 3 天后,我的 iOS 应用程序出现问题。我正在尝试查明问题,不知道是数据损坏问题还是代码问题。
我已经将 iOS 数据库下载到我的 Mac 上,并且可以针对它运行 sql 语句。
有没有办法将以下谓词“转换”为 SQL 语句,以便我可以验证数据?
NSMutableArray *predicates = [[NSMutableArray alloc] init];
NSDate *twoWeeksago = [[NSCalendar autoupdatingCurrentCalendar] dateByAddingUnit:NSCalendarUnitDay
value:-14
toDate:[NSDate date]
options:0];
[predicates addObject:[NSPredicate predicateWithFormat:@"isRemoved == 0"]];
[predicates addObject:[NSPredicate predicateWithFormat:@"(publicationDatetime >= %@) AND (publicationDatetime <= %@)", twoWeeksago, [NSDate date]]];
[predicates addObject:[NSPredicate predicateWithFormat:@"(source == %@) OR (source == %@)", @"BBC", @"Guardian"]];
NSPredicate *predicate = [NSCompoundPredicate andPredicateWithSubpredicates:predicates];
【问题讨论】:
-
您还需要这方面的帮助吗?
-
当然,知道未来会很好:)
-
在下面查看我的答案。我真的希望它可以帮助你。