SHARE
TWEET

Untitled

a guest Jun 24th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any],
  2.                  fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
  3.  
  4.  
  5.     if let messageID = userInfo[gcmMessageIDKey] {
  6.         print("Message ID: (messageID)")
  7.         print("Estoy en 5")
  8.     }
  9.     print(userInfo)
  10.     print("Estoy en 6")
  11.  
  12.     completionHandler(UIBackgroundFetchResult.newData)
  13.  
  14.  
  15.     guard
  16.         let aps = userInfo[AnyHashable("aps")]as? NSDictionary,
  17.         let id = aps["idMensaje"] as? String
  18.  
  19.         else{
  20.  
  21.             return
  22.     }
  23.  
  24.         let user = Auth.auth().currentUser
  25.         let uid = user?.uid
  26.         var ref: DatabaseReference!
  27.         ref = Database.database().reference()
  28.  
  29.         ref.child("mensajes").child(id).child(uid!).child("recibido").setValue("ok")
  30.  
  31.         print("da recibido 6")
  32.  
  33.  
  34.  
  35.         let nav = UINavigationController()
  36.  
  37.         let principal:ViewControllerNotificacion = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "vcNotificaciones") as! ViewControllerNotificacion
  38.         principal.idMensaje = id
  39.         nav.viewControllers = [principal]
  40.         self.window!.rootViewController = nav
  41.         self.window?.makeKeyAndVisible()
  42.         print("Estoy en prueba1")
  43.  
  44.  
  45.  
  46.  
  47.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top