【发布时间】:2017-09-27 09:30:39
【问题描述】:
我是 iOS 新手,在应用程序运行时显示本地通知时遇到问题。 我的代码是这样的
UILocalNotification* localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:0]; //Enter the time here in seconds.
localNotification.alertBody = @"Message hear";
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.repeatInterval = NSCalendarUnitMinute; //Repeating instructions here.
localNotification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
我在单击按钮时编写了此代码,但它没有向我显示通知。 提前致谢!
【问题讨论】:
-
如果应用程序正在运行,为什么会显示通知?通知是让用户启动应用程序的一种方式。如果应用程序已经在运行,为什么要这样做?
标签: ios objective-c uilocalnotification