> ## Documentation Index
> Fetch the complete documentation index at: https://moengage-doc-2315-external-css-font-urls.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-doc-2315-external-css-font-urls/ihIsaOZe9_SIMB6G/images/moengage_d10ae6.png?fit=max&auto=format&n=ihIsaOZe9_SIMB6G&q=85&s=f6652d649822325a4be961f2d856aeed" 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-doc-2315-external-css-font-urls/2tH8LXs478yca2yy/images/moengage_911e54.png?fit=max&auto=format&n=2tH8LXs478yca2yy&q=85&s=d1c79115f7bbbd336ea2df0ce944af2b" 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-doc-2315-external-css-font-urls/oAXSwkhnruBu5W5a/images/moengage_340deb.png?fit=max&auto=format&n=oAXSwkhnruBu5W5a&q=85&s=f134fad9602006c708ca65d1c6267a69" 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-doc-2315-external-css-font-urls/Iezim28Dq9VwdHEg/images/moengage_cf2e7a.png?fit=max&auto=format&n=Iezim28Dq9VwdHEg&q=85&s=413db6476367db2971da38274d2922ce" 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-doc-2315-external-css-font-urls/ZfJuHRQ5QJzmarcA/images/moengage_b62459.png?fit=max&auto=format&n=ZfJuHRQ5QJzmarcA&q=85&s=afeee4561c4bc257b0fa0440c3c340ab" 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-doc-2315-external-css-font-urls/Quad1c3aDceYb6l-/images/moengage_aaf96d.png?fit=max&auto=format&n=Quad1c3aDceYb6l-&q=85&s=00dc1216466f1b4a8d1a98abe2ecb338" 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-doc-2315-external-css-font-urls/PrkNoPg1FOFbLFn1/images/moengage_48edea.png?fit=max&auto=format&n=PrkNoPg1FOFbLFn1&q=85&s=a968bc3d145ea589e867bef7d95d7b2a" 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-doc-2315-external-css-font-urls/CrIKANdm7ViaWFJj/images/moengage_26e08d.png?fit=max&auto=format&n=CrIKANdm7ViaWFJj&q=85&s=760a928a05009be99dade213e85a1aaa" alt="debug.png" width="1750" height="556" data-path="images/moengage_26e08d.png" /> <img src="https://mintcdn.com/moengage-doc-2315-external-css-font-urls/b-969GLajbyiENBK/images/moengage_3ed4ee.png?fit=max&auto=format&n=b-969GLajbyiENBK&q=85&s=59e039f335c7690798a37bba89530c9e" alt="target.png" width="1832" height="446" data-path="images/moengage_3ed4ee.png" /> <img src="https://mintcdn.com/moengage-doc-2315-external-css-font-urls/WxS3YZfik7eJr1oJ/images/moengage_c6b4f5.png?fit=max&auto=format&n=WxS3YZfik7eJr1oJ&q=85&s=3a8d241e571a2b856cb3f447d7b8f42c" alt="duplicate.png" width="1826" height="976" data-path="images/moengage_c6b4f5.png" />
