我正在使用azure pulltoquery方法中的同步表的日期属性上的谓词进行同步。所需物品仅在过去2天内获得物品。从iOS客户端谓词问题查询Azure可同步?
NSDate *now = [NSDate date];
NSDate *twoDaysAgo = [now dateByAddingTimeInterval:-2*24*60*60];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"];
NSString *toString = [dateFormatter stringFromDate:twoDaysAgo];
NSPredicate * predicate = [NSPredicate predicateWithFormat:@"(updatedAt>= %@)",toString];
但我正在逐渐从Azure服务发现错误操作类型“Edm.DateTimeOffset”和“Edm.String”的运营商那种“GreaterThanOrEqual”。
这里的示例代码由微软提供。在提供的链接中查找以下方法。
- (空)pullData:(QSCompletionBlock)完成
所以你的意思是我的断言是正确的,但日期格式是错误的?我已经尝试过使用静态日期,因为它会显示“ERROR Error Domain = com.Microsoft .. Code = -1400”谓词不受支持。“另外在pullData方法中,我们必须传递queryId,在示例中它会取回所有数据[self.syncTable] pullWithQuery:query queryId:@“allTodoItems”completion:^(NSError * error){ [self logErrorIfNotNil:error]; }];; };增量同步的queryId是什么? –
如果您使用查询ID,那么您正在使用增量同步。任何字符串都将用作查询ID。有关日期查询的示例,请参阅MSQuery测试:https://github.com/Azure/azure-mobile-服务/ BLOB /主/测试/的iOS/ZumoE2ETestApp/ZumoE2ETestApp/ZumoQueryTests.m#L82 –