Skip to content

Instantly share code, notes, and snippets.

@meyusufdemirci
Last active March 31, 2018 15:54
Show Gist options
  • Save meyusufdemirci/bc807619594457d1ee8339cf99db45b5 to your computer and use it in GitHub Desktop.
Save meyusufdemirci/bc807619594457d1ee8339cf99db45b5 to your computer and use it in GitHub Desktop.
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
switch application.applicationState {
// uygulama ön planda aktif kullanılıyorken
case .active:
break
// uygulama arka planda çalışıyor ve etkinlikleri alabiliyor
case .background:
break
// uygulama arka planda çalışıyor ama etkinlikleri alamıyor
case .inactive:
if let notificationDict = userInfo["aps"] as? [String: Any] {
if let viewController = self.window?.rootViewController as? ViewController {
DispatchQueue.main.async {
viewController.setAction(actionType: (notificationDict["actionType"] as? String)!)
self.actionType = nil
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment