【发布时间】:2018-08-06 23:41:29
【问题描述】:
现在我有 1 种方法来推送通知。
我使用 firebase 控制台(https://console.firebase.google.com/),然后分配捆绑 ID 并发送推送通知。
现在我有一个问题。
如何从我的应用程序上的 firebase 控制台检测(使用 swift)。
这是我的 didReceiveRemoteNotification 代码
didReceiveRemoteNotification 代码
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {
if let messageID = userInfo[gcmMessageIDKey] {
print("Message ID1: \(messageID)")
}
var pushId = userInfo["push-id"] as? String
if(pushId == nil){
pushId = "-1"
}
fcmAccessCount(pushId: pushId!)
badgeCount()
switch application.applicationState {
case .active:
break
case .inactive:
break
case .background:
break
default:
break
}
if let aps = userInfo["aps"] as? NSDictionary {
if let alert = aps["alert"] as? String {
let alert = UIAlertController(title: "message is... ", message: alert, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.window?.rootViewController?.present(alert, animated: true, completion: nil)
}
}
}
【问题讨论】:
-
我没有正确理解您的问题。你想达到什么目标?
-
未解决的问题。
-
对不起我的英语不好我编辑
-
您要检查通知是否已发送到您的设备上?
-
感谢您回复@iDeveloper。我想检查(检测)关于我的应用程序源代码的通知。
标签: ios swift curl push-notification firebase-console