我目前正在这样做,但通知会重复多次。请帮助。
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
UIApplicationState state = [application applicationState];
if (state == UIApplicationStateActive) {
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
//localNotification.userInfo = @"Hey";
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.alertBody = self.notiname;
localNotification.fireDate = [NSDate date];
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
AudioServicesPlaySystemSound(1104);
}
}