0

我如何能够使用 FQL 获取一天前在 Facebook 上拍摄的所有照片?

目前,我有:

SELECT src_small FROM photo WHERE pid IN (SELECT pid FROM photo_tag WHERE subject=me()) AND created = previousDayTimeStamp

但是,UNIX TIME 来自:

previousDay = [iOSCalender components:NSDayCalendarUnit fromDate:self.currentDate];
previousDay.day = -1;

previousDate = [iOSCalender dateByAddingComponents:previousDay toDate:self.currentDate options:0];

NSString *previousDayTimeStamp = [NSString stringWithFormat:@"%f",
                                 [previousDate timeIntervalSince1970]];

引用精确到秒的日期,FQL 中的“创建”字段也是如此。有没有办法可以缩短时间,以便最详细的信息是当天?

4

1 回答 1

0

只需计算到当天的小时数,以及到小时的分钟数,然后将其相反设置为NSDateComponents

//Note: this line changes as you'll need to get Hour and Minute units as well
previousDay = [iOSCalender components:(NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit) fromDate:currentDate];
previousDay.day = -1;
previousDay.hour = (previousDay.hour * -1);
previousDay.minute = (previousDay.minute * -1);

previousDate = [iOSCalender dateByAddingComponents:previousDay toDate:currentDate options:0];

NSString *previousDayTimeStamp = [NSString stringWithFormat:@"%f",
                                  [previousDate timeIntervalSince1970]];
于 2012-11-27T00:09:31.303 回答