現在の日付から7日を引くことはできないようです。これは私がやっている方法です:
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *offsetComponents = [[NSDateComponents alloc] init];
[offsetComponents setDay:-7];
NSDate *sevenDaysAgo = [gregorian dateByAddingComponents:offsetComponents toDate:[NSDate date] options:0];
SevenDaysAgo は、現在の日付と同じ値を取得します。
助けてください。
編集:私のコードでは、現在の日付を取得する変数を正しい日付に置き換えるのを忘れていました。したがって、上記のコードは機能します。