草庐IT

UILocalNotification

全部标签

ios - 在同一天 swift 安排 UILocalNotification

我正在尝试安排UILocalNotifications。我想要实现的功能是在特定的一天重复通知,比如(每个星期一),这将由用户选择。有什么方法可以安排UILocalNotification,以便仅在那天触发通知。letnotification=UILocalNotification()letdict:NSDictionary=["ID":"yourIDgoeshere"]notification.userInfo=dictas![String:String]notification.alertBody="\(title)"notification.alertAction="Open"n

ios - UILocalNotifications 不会出现在锁定的屏幕上

我在我的iPhone上运行了我的应用程序。(只需连接我的手机并选择我的iPhone作为目标。)我在我的应用程序中构建了本地通知,这些通知在iPhone上按时完美显示。但是,即使在设置->通知->[我的应用]->在锁定屏幕上显示已打开,它们也不会出现在锁定屏幕上。奇怪的是它们甚至出现在通知中心。这类似于UILocalNotificationnotshowinginthelockscreen但是我在那里也没有找到答案。有人遇到过吗?我认为这可能是一个iOS错误。我使用的是迄今为止最新的iOS、Xcode、OSX。 最佳答案 您必须获得在

ios - 当 App 在前台 Swift 4 iOS 11 时获取本地通知

我想在我的应用程序处于前台时收到本地通知,当我尝试使用以下代码时它从未触发通知,但是当我在后台进入应用程序时它确实触发了。这是我尝试过的://ScheduleaLocalNotificationfuncScheduleNotification(timeInterval:Double,repeats:Bool,notificationBody:String,title:String){lettrigger=UNTimeIntervalNotificationTrigger.init(timeInterval:timeInterval,repeats:repeats)letcenter=U

ios - 本地通知未触发

我正在尝试使用本地通知,这是我的代码:应用委托(delegate)application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes:[UIUserNotificationType.Sound,UIUserNotificationType.Alert,UIUserNotificationType.Badge],categories:nil))notificationViewControllerletlocalNotification:UILocalNotification=UILocalNot

swift - 通知扩展访问核心数据

我正在尝试使用自定义UI发送本地通知,向用户显示比通知本身包含的内容更多的内容。我想从应用程序的核心数据中获取内容。可能吗?当我调试通知内容扩展时,它在检索核心数据模型路径的以下行崩溃:让modelURL=NSBundle.mainBundle().URLForResource("Model",withExtension:"momd")!此外,当我从通知扩展代码中print(NSBundle.allBundles())时,它只打印与扩展相关的代码(.../PlugIns/NotificationContent.appex>(已加载))那么有没有办法在通知内容扩展中访问核心数据呢?我也想

ios - 未显示 UILocalNotification 操作的操作

我正在尝试添加/安排提供两个操作的本地通知,如下所示:如果我已经在使用我的手机,我还希望通知显示为横幅提醒,我只需向下滑动手机即可查看操作。现在,我正在成功安排通知,它确实出现在锁定屏幕上。但是,当我向左滑动,然后点击“查看”时,我看不到我的操作。这是我的代码:funcaddNewNotificationWith(name:String,date:Date){letmessage="Youwillseethis,butcan'tdoanything!lol."letnewLocalNotif=UILocalNotification()newLocalNotif.fireDate=due

ios - Swift - 本地通知不会被触发

我正在使用Swift3进行编码,我只是想立即发送通知,没有任何延迟或间隔。但是,通知永远不会被触发。这是我的代码..ViewController代码importUserNotificationsclassHomeViewController:UIViewController{varisGrantedNotificationAccess:Bool=falseoverridefuncviewDidLoad(){super.viewDidLoad()UNUserNotificationCenter.current().requestAuthorization(options:[.alert,

ios - 无法在 Xcode 6.1/段错误 : 11 中存档工作 6.0.1 Swift 项目

命令因信号而失败:段错误:11在[/Users/thedude/Documents/Repositories/MyProject/Data.swift:258:36-line:258:56]RangeText="UILocalNotification()"处对表达式进行类型检查时错误是指以下代码行。varnotification=UILocalNotification()//alsotriedvarnotification:UILocalNotification=UILocalNotification()问题仅在归档(提交到商店)时出现。如果我注释掉那行代码,错误只会出现在其他随机位置

swift - iOS8 - UILocalNotification,稍后从代码中检查权限

我正在为iOS8使用Swift编写我的应用程序。我想使用UILocalNotification来通知用户一些事情。为此,我已在应用启动时请求许可:application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes:UIUserNotificationType.Sound|UIUserNotificationType.Alert|UIUserNotificationType.Badge,categories:nil))确认框显示请求许可。如果用户允许,则没有问题。如果用户未授予权限,我如何检查是

ios - 带有振动的 UILocalNotification

有什么方法可以在触发通知的同时添加本地通知的振动效果。letAlarmNotification:UILocalNotification=UILocalNotification()AlarmNotification.alertBody=titleAlarmNotification.alertAction="OpenApp"AlarmNotification.category="AlarmCategory"AlarmNotification.soundName=soundName+".mp3"AlarmNotification.timeZone=NSTimeZone.defaultTime