【发布时间】:2016-08-22 10:42:08
【问题描述】:
我正在安排计时器并向用户发送一些有关某些数据的本地通知,例如 - 如果附近有商店。
func configureNotification(shop: Shop) {
let notification = UILocalNotification()
notification.fireDate = NSDate(timeIntervalSinceNow: 0)
notification.alertBody = "There is a store \(shop.name) near!"//Localized().near_shop_string + shopName
notification.alertAction = "Swipe to see offer!"//Localized().swipe_to_see_string
notification.soundName = UILocalNotificationDefaultSoundName
UIApplication.sharedApplication().scheduleLocalNotification(notification)
}
当应用程序在后台运行时,如果用户坐标附近有商店,则会有本地通知。
例如,收到了三个关于不同商店的本地通知,用户滑动第二个通知并从中激活应用。
问题是,要识别从哪个特定通知 applicationDidBecomeActive 启动,一些 launcOptions,至于来自服务器的推送通知?有什么解决办法吗?
【问题讨论】:
标签: ios swift push-notification location uilocalnotification