我想展示我为我的Apple Watch App创建的短视或长视界面。
已经起作用的是以下内容:
该应用程序执行一些后台工作,然后通知用户。这发生在UILocalNotification上。
当iPhone被锁定,手表在我的手臂上时,手表会震动,只显示一个简单的通知,而不是长或短的通知。
我看到有人让它与推送通知-> Apple Watch: dynamic Long Look not shown, when push opened from Notification Center一起工作,目前我的应用程序不支持推送。
有没有人知道一种方法,可以在没有服务器进行推送的情况下显示长或短的通知?
我使用以下代码发送通知:
var localNotification = UILocalNotification()
//---the message to display for the alert---
localNotification.alertBody =
"You have entered the region you are monitoring"
//---uses the default sound---
localNotification.soundName = UILocalNotificationDefaultSoundName
//---title for the button to display---
localNotification.alertAction = "Details"
//---display the notification---
UIApplication.sharedApplication().presentLocalNotificationNow(localNotification)
诚挚的问候,
西蒙
发布于 2015-09-11 07:52:17
您必须使用与手表应用程序情节串连图板中的值相匹配的值来设置'category‘属性。
发布于 2015-06-12 05:47:08
在您的NotificationController.swift文件(或者您为自定义WKUserNotificationInterfaceController类命名的其他文件)中,是否取消了函数"didReceiveLocalNotification“的注释(默认情况下已将其注释掉)?否则,我认为手表不会显示短视或长视通知。
编辑:我弄错了;该函数只与动态(长视)接口有关,与静态接口无关。我不确定为什么静态接口不会出现。
https://stackoverflow.com/questions/30536339
复制相似问题