Guest User

Untitled

a guest
Feb 26th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any],
  2. fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
  3.  
  4. redirectToScreen(notificaiton: userInfo)
  5.  
  6. completionHandler(UIBackgroundFetchResult.newData)
  7. }
  8.  
  9. //Notify through Notification center
  10. func redirectToScreen(notificaiton: [AnyHashable: Any]) {
  11. NotificationCenter.default.post(name: NSNotification.Name.init(rawValue: "handlePush"), object: dict)
  12.  
  13. }
  14.  
  15. //Observer goes here and call API
  16. let spinner = showLoader(view: self.view) // App goes stuck here and loaded process continuously, response is not getting
  17.  
  18. Alamofire.request(kURl, method: .post, parameters: param, encoding: URLEncoding.httpBody, headers: nil).authenticate(user: R.string.keys.basicAuthUsername(), password: R.string.keys.basicAuthPassword()).responseSwiftyJSON(completionHandler: {
  19. spinner.dismissLoader()
  20.  
  21. })
Add Comment
Please, Sign In to add comment