3

選択した日のイベントを返す述語がありますが、異なるタイムゾーンの日付を返します。ローカルタイムゾーンに従って日付を検索する述語を作成するにはどうすればよいですか?

NSTimeInterval time = floor([[NSDate date] timeIntervalSinceReferenceDate] / 86400.0) * 86400.0;
NSDate *start = [NSDate dateWithTimeIntervalSinceReferenceDate:time];

NSTimeInterval secondsInTwentyFourHours = (24 * 60 * 60);
NSDate *end = [start dateByAddingTimeInterval:secondsInTwentyFourHours];

// Create the predicate from the event store's instance method
NSPredicate *predicate = [store predicateForEventsWithStartDate:start endDate:end calendars:nil];
// Fetch all events that match the predicate
events = [store eventsMatchingPredicate:predicate];
4

0 に答える 0