試試這個雙向的,並得到這是你嗎?
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:5];
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.alertBody = @"You have long time to care your......";
localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber]+1;
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.repeatInterval = kCFCalendarUnitMinute;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
[localNotification release];
localNotification = nil;
//////////// OR ///////////////
UILocalNotification *localNotification = [[UILocalNotification alloc]init];
// Set the notification time.
localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:10];
// You can specify the alarm sound here.
localNotification.soundName = UILocalNotificationDefaultSoundName;
//OR
localNotification.soundName = @"sound.caf";
// Set the alertbody of the notification here.
localNotification.alertBody = @"Test Alert";
// Create the buttons on the notification alertview.
localNotification.alertAction = @"View";
// You can also specify custom dictionary to store informations
NSDictionary *infoDict = [NSDictionary dictionaryWithObject:@"alarm#2" forKey:@"notifiKey"];
localNotification.userInfo = infoDict;
//Repeat the notification.
localNotification.repeatInterval = NSDayCalendarUnit;
// Schedule the notification
[[UIApplication sharedApplication]scheduleLocalNotification:localNotification];