> ## Documentation Index
> Fetch the complete documentation index at: https://moengage-gr001-flows-limits.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 8.x.x) When Notification Content Extension is Not Implemented?

> Fix iOS push template issues (carousel, colors, fonts) on SDK 8.x.x by implementing a Notification Content Extension for your MoEngage 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-gr001-flows-limits/XanTIJLrroLB7wTv/images/moengage_381db3.png?fit=max&auto=format&n=XanTIJLrroLB7wTv&q=85&s=d928f8a485152849927abf95c8583a26" alt="NCE.png" width="1454" height="1040" data-path="images/moengage_381db3.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 alt="name swift.png" src="https://mintcdn.com/moengage-gr001-flows-limits/4lVRo6LA8ARVlIIL/images/moengage_6dbf7c.png?fit=max&auto=format&n=4lVRo6LA8ARVlIIL&q=85&s=7fb9dce62e341cb1d3ae5923a72e7c3d" width="1412" height="1016" data-path="images/moengage_6dbf7c.png" />
* Add the **AppGroupId** to the Notification Content Extension’s **Signing & Capabilities** settings. <img alt="signing.png" src="https://mintcdn.com/moengage-gr001-flows-limits/Fdz8iVYgGGP4X72r/images/moengage_cfae58.png?fit=max&auto=format&n=Fdz8iVYgGGP4X72r&q=85&s=5522a8b2358524f38852c3b315f04002" width="2560" height="836" data-path="images/moengage_cfae58.png" />
* Set the minimum deployment iOS version of the Notification Content Extension to match the main app’s iOS version.
  <img alt="deployment.png" src="https://mintcdn.com/moengage-gr001-flows-limits/yYs5Ix33zRtf4X_-/images/moengage_1c1516.png?fit=max&auto=format&n=yYs5Ix33zRtf4X_-&q=85&s=5450b27da77670f73a42f07f5a9fbfd6" width="1920" height="455" data-path="images/moengage_1c1516.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()
           MORichNotification.setAppGroupID("group.com.XXXXXXXXXXXXXXXX")
       }
       
       func didReceive(_ notification: UNNotification) {
           if #available(iOSApplicationExtension 12.0, *) {
               MORichNotification.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 alt="main.png" src="https://mintcdn.com/moengage-gr001-flows-limits/4lVRo6LA8ARVlIIL/images/moengage_6c5271.png?fit=max&auto=format&n=4lVRo6LA8ARVlIIL&q=85&s=cfb161ff21615650d7a1f0f36fd9913a" width="3360" height="1646" data-path="images/moengage_6c5271.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-gr001-flows-limits/7OtjbvwehM6mW17A/images/moengage_8c6d4d.png?fit=max&auto=format&n=7OtjbvwehM6mW17A&q=85&s=9f41875f0466eda27daa2e5e7f412e62" alt="NSExtension.png" width="1948" height="786" data-path="images/moengage_8c6d4d.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 alt="copy only.png" src="https://mintcdn.com/moengage-gr001-flows-limits/XyAB1fvO-iq3DU9_/images/moengage_241f44.png?fit=max&auto=format&n=XyAB1fvO-iq3DU9_&q=85&s=c2046f6a5a0ba8a334a2aeb0d69b6cf4" width="2740" height="930" data-path="images/moengage_241f44.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-gr001-flows-limits/1OoGi8dJbKAsGMMf/images/moengage_e1336f.png?fit=max&auto=format&n=1OoGi8dJbKAsGMMf&q=85&s=4aea0c853f892aa3033b1e9f3d5b744c" alt="debug.png" width="1750" height="556" data-path="images/moengage_e1336f.png" />

   <img src="https://mintcdn.com/moengage-gr001-flows-limits/uiMMNntXH1eQbZiM/images/moengage_585502.png?fit=max&auto=format&n=uiMMNntXH1eQbZiM&q=85&s=d7b33bd1edc9a5b2f4d264ceb8aa6d55" alt="target.png" width="1832" height="446" data-path="images/moengage_585502.png" />

   <img src="https://mintcdn.com/moengage-gr001-flows-limits/iDb_h-WZNsq_90W2/images/moengage_2f8b4e.png?fit=max&auto=format&n=iDb_h-WZNsq_90W2&q=85&s=871fea0a9492d4717337331dd4af2006" alt="duplicate.png" width="1826" height="976" data-path="images/moengage_2f8b4e.png" />
