我有如下通知节点,保留一些动作来通知用户。如果应用程序在后台工作,我可以使用observeEventType(.ChildAdded ...
tabBarVC 类发送本地通知。但是如果应用程序关闭它不起作用。
我正在使用 Firebase,并连接了远程通知服务,pod 'Firebase/Messaging'
因此我只能发送消息。我想使用notification
下面的父节点过滤本地通知。
怎么可能?
notification
notification_id0
byUID:
toUID:
ownerID:
type:
content:
我也在didFinishLaunchingWithOptions中定义了..
let notificationTypes: UIUserNotificationType = [UIUserNotificationType.Alert, UIUserNotificationType.Sound, UIUserNotificationType.Badge]
let notificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)
UIApplication.sharedApplication().registerUserNotificationSettings(notificationSettings)
application.registerForRemoteNotifications()
application.registerUserNotificationSettings(notificationSettings)
这对于远程 Firebase 通知运行良好。
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
print("Meesage ID \(userInfo["gcm_message_id"]!)")
print(userInfo)
}