【发布时间】:2015-05-29 18:10:41
【问题描述】:
我想展示我为 Apple Watch 应用创建的 Short-Look 或 Long-Look 界面。
已经生效的如下:
应用程序执行一些后台工作,然后通知用户。这发生在 UILocalNotification 中。
当 iPhone 被锁定并且手表在我的手臂上时,手表会振动并只显示一个简单的通知,而不是 Long 或 Short-Look 通知。
我看到有人使用推送通知来处理它 -> 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)
最好的问候,
西蒙
【问题讨论】:
标签: ios swift notifications watchkit