> ## Documentation Index
> Fetch the complete documentation index at: https://moengage-sdk-deprecated-versions-all-platforms.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Avoid Push Template Issues in iOS Push Notifications (SDK version 9.x.x) When Notification Content Extension is Not Implemented?

> Fix iOS push template issues (carousel, colors, fonts) on SDK 9.x.x by setting up a Notification Content Extension in your MoEngage iOS project.

## Problem

Push templates (carousel images, background color, font color, and so on) do not display correctly in Push notifications when the Notification Content Extension is not implemented.

## Instruction

Perform the following steps:

1. Create a Notification Content Extension Target.
   <img src="https://mintcdn.com/moengage-sdk-deprecated-versions-all-platforms/jOE6pde7b4zW_qqg/images/moengage_d10ae6.png?fit=max&auto=format&n=jOE6pde7b4zW_qqg&q=85&s=c7f472aef55b2a5c57c9809de1528b80" alt="NCE.png" width="1454" height="1040" data-path="images/moengage_d10ae6.png" />
   * *Name the Extension Target.* Choose a name for the extension target. **Swift** is recommended as the language as it works seamlessly with Objective-C projects too. <img src="https://mintcdn.com/moengage-sdk-deprecated-versions-all-platforms/tBOqttMLA8XHICm2/images/moengage_911e54.png?fit=max&auto=format&n=tBOqttMLA8XHICm2&q=85&s=2061635f9d8a6c9ba35adcaec0d5271c" alt="name swift.png" width="1412" height="1016" data-path="images/moengage_911e54.png" />
   * Add the **AppGroupId** to the Notification Content Extension’s **Signing & Capabilities** settings.
     <img src="https://mintcdn.com/moengage-sdk-deprecated-versions-all-platforms/R3hGj5spzaLu41qK/images/moengage_340deb.png?fit=max&auto=format&n=R3hGj5spzaLu41qK&q=85&s=f5de109553254e3b1e2646324c62cac7" alt="signing.png" width="2560" height="836" data-path="images/moengage_340deb.png" />
   * Set the minimum deployment iOS version of the Notification Content Extension to match the main app’s iOS version.
     <img src="https://mintcdn.com/moengage-sdk-deprecated-versions-all-platforms/meMV1X6o7SuZ1BBG/images/moengage_cf2e7a.png?fit=max&auto=format&n=meMV1X6o7SuZ1BBG&q=85&s=2ffa5aab70a5d0d33e904963e1eafeac" alt="deployment.png" width="1920" height="455" data-path="images/moengage_cf2e7a.png" />
2. *Integrate the MORichNotification Framework into the Notification Content Extension Target.*
   * In your podfile, add the Notification Content Extension as a separate target and install the **MORichNotification** framework.
     ```swift Swift theme={null}
     target 'MoEngageDemo' do
     use\_frameworks!
     pod 'MoEngage-iOS-SDK'
     end
     target 'MoEngageNotificationService' do
     use\_frameworks! #use use\_frameworks only if included in main target as in above scenario
     pod 'MoEngageRichNotification'
     end
     target 'MoegageRichContent" do
     use\_frameworks! #use use\_frameworks only if included in main target as in above scenario
     pod 'MoEngageRichNotification'
     end
     ```
3. Code changes in **NotificationViewController.swift** file.
   ```swift Swift theme={null}
   import UIKit
   import UserNotifications
   import UserNotificationsUI
   import MoEngageRichNotification
   class NotificationViewController: UIViewController, UNNotificationContentExtension {
       @IBOutlet var label: UILabel?
       
       override func viewDidLoad() {
           super.viewDidLoad()
           MoEngageSDKRichNotification.setAppGroupID("group.com.XXXXXXXXXXXXXXXX")
       }
       
       func didReceive(_ notification: UNNotification) {
           if #available(iOSApplicationExtension 12.0, *) {
               MoEngageSDKRichNotification.addPushTemplate(toController: self, withNotification: notification) 
           } else {
               // Fallback on earlier versions
           }
       }
   }
   ```
4. Select **MainInterface.storyboard** in the Content extension, remove the default label, and set the background color of the View to clear.

<img src="https://mintcdn.com/moengage-sdk-deprecated-versions-all-platforms/WtqvypWii1Q4_ivG/images/moengage_b62459.png?fit=max&auto=format&n=WtqvypWii1Q4_ivG&q=85&s=db598f8847dd7c9169fbcc49751e6f49" alt="main.png" width="3360" height="1646" data-path="images/moengage_b62459.png" />

5. Info.plist changes:
   ```swift Swift theme={null}
   <key>NSExtensionAttributes</key> 
   <dict>
         <key>UNNotificationExtensionCategory</key>
         <string>MOE_PUSH_TEMPLATE</string>
         <key>UNNotificationExtensionDefaultContentHidden</key>
         <true/>
         <key>UNNotificationExtensionInitialContentSizeRatio</key>
         <real>1.2</real>
         <key>UNNotificationExtensionUserInteractionEnabled</key>
         <true/>
   </dict>
   ```
   <img src="https://mintcdn.com/moengage-sdk-deprecated-versions-all-platforms/AQjlzBXfA9CDpHqB/images/moengage_aaf96d.png?fit=max&auto=format&n=AQjlzBXfA9CDpHqB&q=85&s=6e3c5e47c16c2e63dddcabd2234c424a" alt="NSExtension.png" width="1948" height="786" data-path="images/moengage_aaf96d.png" />
6. *Check Build Phases in Main App Target.*
   * In Embed App Extensions/Embed Foundation Extensions, ensure that **Copy only when installing** is not selected. <img src="https://mintcdn.com/moengage-sdk-deprecated-versions-all-platforms/dAssV9T2o56fV71R/images/moengage_48edea.png?fit=max&auto=format&n=dAssV9T2o56fV71R&q=85&s=de59504d6a0e3042631f97e3e2cdfb88" alt="copy only.png" width="2740" height="930" data-path="images/moengage_48edea.png" />
7. *Ensure Consistent appGroupId Across Configurations.*
   * Verify that the **appGroupId** is consistent across all schemes and configurations (for example, Debug/Release/QA/UAT) in the project.
8. *Align Build Configuration.*
   * When running or archiving the project, make sure that the Build Configuration for the Main Target, Notification Service Extension, and Notification Content Extension Target points to the same scheme/configuration. <img src="https://mintcdn.com/moengage-sdk-deprecated-versions-all-platforms/SgLgI1ciWt54LpxM/images/moengage_26e08d.png?fit=max&auto=format&n=SgLgI1ciWt54LpxM&q=85&s=e78af6d9f51d07914aeb085e8183fc12" alt="debug.png" width="1750" height="556" data-path="images/moengage_26e08d.png" /> <img src="https://mintcdn.com/moengage-sdk-deprecated-versions-all-platforms/pWLLvVv_das8r-Zd/images/moengage_3ed4ee.png?fit=max&auto=format&n=pWLLvVv_das8r-Zd&q=85&s=270faf1a3247fd86e18c716cfe3ab2f7" alt="target.png" width="1832" height="446" data-path="images/moengage_3ed4ee.png" /> <img src="https://mintcdn.com/moengage-sdk-deprecated-versions-all-platforms/ccZavoac99kBXael/images/moengage_c6b4f5.png?fit=max&auto=format&n=ccZavoac99kBXael&q=85&s=1b29d6c2dee3373f9485a3146760c5a7" alt="duplicate.png" width="1826" height="976" data-path="images/moengage_c6b4f5.png" />
