EVGCampaignHandler Block Reference
Callback implemented by the app to handle potential custom data campaigns served in response to Marketing Cloud Personalization actions generated by the user interacting with the app.
- For a view controller, it is recommended to setup handlers in
viewWillAppear:, as shown in the examples in this section.
- Validate the expected campaign data/JSON before processing, since campaigns are dynamic and designed in the Personalization web app.
- The same campaign could be re-served, so when applicable, check if the same content is already active. For example, there’s no need to re-render the same message/UI to the user if it’s still visible. This is especially true when testing a specific experience, see
- Follow best practices using weak references within the handler block, to avoid retaining objects in memory longer than expected, which could lead to memory bloat and unexpected behavior. The following examples correctly use weak reference.
The following is example code that expects the featured product’s name and updates a
UILabel on screen.