1
我試圖對我的對象請求執行自定義過濾器,它將返回在最後一小時內創建的所有對象。但是,以下不起作用:Quickblox iOS - 比較自定義對象請求中的日期
NSMutableDictionary *getRequest = [NSMutableDictionary dictionary];
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
// Show vehicles based on the user's selected radius (add filter)
NSInteger radius = 500 * 1.6 * 1000;
NSDate *minusOneHr = [[NSDate date] dateByAddingTimeInterval:-60*60];
[getRequest setObject:[NSString stringWithFormat:@"%f,%f;%li",[[prefs objectForKey:@"longitude"] floatValue],[[prefs objectForKey:@"latitude"] floatValue], (long)radius] forKey:@"alertLocation[near]"];
[getRequest setObject:[NSDate date] forKey:@"created_at[gt]"];
[getRequest setObject:minusOneHr forKey:@"created_at[lt]"];
[QBRequest objectsWithClassName:@"Alerts" extendedRequest:getRequest successBlock:^(QBResponse *response, NSArray *objects, QBResponsePage *page) {
[[self.tabBarController.tabBar.items objectAtIndex:2] setBadgeValue:[NSString stringWithFormat:@"%lu", (unsigned long)objects.count]];
} errorBlock:^(QBResponse *response) {
NSLog(@"error: %@", response.error);
//
}];
任何人都知道是否可以在created_at日期使用gt和lt運算符?
鏈接只回答不是很有幫助。爲什麼不在這裏爲未來的提問者帶來相關的作品? –