# iOS Notification Handling

&#x20;iOS does differentiate between the action which happens when pressing the notification and the quick actions which are presented to the user when long pressing a notification.

## Firebase Cloud Messaging <a href="#iosnotificationhandling-firebasecloudmessaging" id="iosnotificationhandling-firebasecloudmessaging"></a>

To integrate MOOST Notifications into your iOS Application you can use Firebase Cloud Messaging (FCM). With FCM you have a centralized tool to send notifications to your End-users either to Android or iOS Apps. For more information on how to setup Firebase for iOS you can consult [this documentation](https://firebase.google.com/docs/cloud-messaging/ios/client#add_firebase_to_your_apple_project).

## Handling FCM notifications <a href="#iosnotificationhandling-handlingfcmnotifications" id="iosnotificationhandling-handlingfcmnotifications"></a>

```swift
func userNotificationCenter(_ center: UNUserNotificationCenter,
       didReceive response: UNNotificationResponse,
       withCompletionHandler completionHandler: 
         @escaping () -> Void) {
       
   // Get the additional information from the original notification.
   let userInfo = response.notification.request.content.actions
   let url = userInfo["parameter"]["en"] as! String
        
   // Perform the task associated with the action.
   switch response.actionIdentifier {
    case "OPENAPP":
        sharedAppManager.openApp()
        break
    case "STOPDELIVERY":
        sharedAppManager.sendStopDelivery()
        break
    case "OPENWEB":
        sharedAppManager.openWeb(url)
        break
    default:
        sharedAppManager.openApp(url)
        break
   }
    
   // Always call the completion handler when done.    
   completionHandler()
}
```
