--- title: "Fire real-time events in iOS" slug: "ios-events" updated: 2026-06-09T22:16:57Z published: 2026-06-09T22:16:57Z canonical: "docs.xtremepush.com/ios-events" stale: true --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.xtremepush.com/llms.txt > Use this file to discover all available pages before exploring further. # Fire real-time events in iOS Review how to fire events from your iOS app In-app messages are triggered based on real-time in-app events. Real-time events can also be used for triggering comms like push notifications, email, SMS and inbox messages. This guide describes how to fire events from your iOS app. ## Custom events If you want to send a message to your customers after custom events occur then you must fire these events with the `hitEvent` method. For example, if you want to track as an event whenever a user opens the settings page, you would do it as follows: **Swift** ```swift // Tagging opened_settings in code where settings is opened XPush.hitEvent("opened_settings") ``` **Objective-C** ```objectivec \\ Tagging opened_settings in code where settings is opened [XPush hitEvent: @"opened_settings"]; ``` The event `opened_settings` will then be available as a trigger option when creating an iOS push message. ![2254](https://cdn.document360.io/b056e88b-f6c1-4bd2-b5b8-08e9336a17c9/Images/Documentation/8578a10cd56ea128592352512827563b3048bbe3bec0d49d7533d3f69998e32b-Screenshot_2024-10-10_at_15.33.35(1).png?sv=2026-02-06&spr=https&st=2026-10-30T01%3A59%3A42Z&se=2026-10-30T02%3A59%3A42Z&sr=c&sp=r&sig=%2B%2FI%2BLFPwJ3WLv86f87zgMWW9rx3x%2B5Qi8OYoO0ZHmf4%3D) Example of an iOS push campaign that will be triggered by the event 'opened_settings'. > [!NOTE] > An event is created in your project whenever you fire it for the first time from your app (as seen before), or you can also manually create it by navigating to **Data Manager > Events > Create event**. ## Event values It's possible to pass a value with the event hit. It could be used for additional segmentation and personalisation of your messages. To pass a string value with the event use: **Swift** ```swift XPush.hitEvent("test", withValue: "payload") ``` **Objective-C** ```objectivec [XPush hitEvent: @"test" withValue: @"payload"]; ``` To pass key-value pairs with the event use: **Swift** ```swift XPush.hitEvent("product_added_to_basket", withValues: [    "product_category": "Sports",    "product_name": "Home Jersey" ]) ``` **Objective-C** ```objectivec [XPush hitEvent: @"product_added_to_basket" withValues: @{  @"product_category": @"Sports",  @"product_name": @"Home Jersey"  }]; ``` ## Session Start There is a default event for tracking session starts or app open events. To enable in-app messaging on app open call the following method before initialising Xtremepush in your App Delegate: **Swift** ```swift XPush.setInAppMessageEnabled(true) ``` **Objective-C** ```objectivec [XPush setInAppMessageEnabled: YES]; ``` From the [Events](/documentation/docs/campaign-events) tab you can then select the trigger **Session Start** to launch an in-app message. ![2248](https://cdn.document360.io/b056e88b-f6c1-4bd2-b5b8-08e9336a17c9/Images/Documentation/0775e1b26085b07d0a5f149ea5276da47f29ca9089dc11b652897bcf2b1961f3-Screenshot_2024-10-10_at_15.34.36(1).png?sv=2026-02-06&spr=https&st=2026-10-30T01%3A59%3A42Z&se=2026-10-30T02%3A59%3A42Z&sr=c&sp=r&sig=%2B%2FI%2BLFPwJ3WLv86f87zgMWW9rx3x%2B5Qi8OYoO0ZHmf4%3D) Example of an In-app campaign triggered on Session Start. > [!TIP] > Only [in-app](/documentation/docs/quick-start-inapp) messages can be triggered on **Session Start**