2

Xcode 4.6.3 で次のチュートリアルを書き直そうとしました - http://vimeo.com/29824336

しかし、24:00 頃にコードがアラームを鳴らさないという問題があります。

-(void) scheduleLocalNotificationWithDate:(NSDate *)fireDate
{
    UILocalNotification *notification = [[UILocalNotification alloc] init];

    notification.fireDate = fireDate;
    notification.alertBody = @"Time to wake up!";
    notification.soundName = @"SNSD-Oh.caf";
    NSLog(@"Ring Ring Ring!");

    [[UIApplication sharedApplication] scheduleLocalNotification: notification];
}

- (IBAction) alarmSetButtonTapped:(id)sender
{    
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    dateFormatter.timeZone = [NSTimeZone defaultTimeZone];
    dateFormatter.timeStyle = NSDateFormatterShortStyle;
    dateFormatter.dateStyle = NSDateFormatterShortStyle;

    NSString *dateTimeString = [dateFormatter stringFromDate: dateTimePicker.date];
    NSLog(@"Alarm Set Button tapped: %@", dateTimeString);

    [self scheduleLocalNotificationWithDate: dateTimePicker.date];
}

私は何を間違えましたか?

4

1 に答える 1