Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any],
- fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
- if let messageID = userInfo[gcmMessageIDKey] {
- print("Message ID: (messageID)")
- print("Estoy en 5")
- }
- print(userInfo)
- print("Estoy en 6")
- completionHandler(UIBackgroundFetchResult.newData)
- guard
- let aps = userInfo[AnyHashable("aps")]as? NSDictionary,
- let id = aps["idMensaje"] as? String
- else{
- return
- }
- let user = Auth.auth().currentUser
- let uid = user?.uid
- var ref: DatabaseReference!
- ref = Database.database().reference()
- ref.child("mensajes").child(id).child(uid!).child("recibido").setValue("ok")
- print("da recibido 6")
- let nav = UINavigationController()
- let principal:ViewControllerNotificacion = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "vcNotificaciones") as! ViewControllerNotificacion
- principal.idMensaje = id
- nav.viewControllers = [principal]
- self.window!.rootViewController = nav
- self.window?.makeKeyAndVisible()
- print("Estoy en prueba1")
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement