> ## Documentation Index
> Fetch the complete documentation index at: https://moengage-unity-sdk-initialization-split.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-unity-sdk-initialization-split/B-H8ECfEYu6COfPW/images/moengage_381db3.png?fit=max&auto=format&n=B-H8ECfEYu6COfPW&q=85&s=6e4ada86f9d10e33acf9f8dfb2c01027" 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-unity-sdk-initialization-split/WqoTjr4uhFcFehvW/images/moengage_6dbf7c.png?fit=max&auto=format&n=WqoTjr4uhFcFehvW&q=85&s=37016d5b0856956e545184f539bd875d" 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-unity-sdk-initialization-split/5Ua6FGi-InVnkjHf/images/moengage_cfae58.png?fit=max&auto=format&n=5Ua6FGi-InVnkjHf&q=85&s=b6cfa49c58346ca2d9a2e51f41cfbfdc" 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-unity-sdk-initialization-split/OstTlkNxT-HYB_-S/images/moengage_1c1516.png?fit=max&auto=format&n=OstTlkNxT-HYB_-S&q=85&s=0d90581958280448625ec21518b8cc86" 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-unity-sdk-initialization-split/WqoTjr4uhFcFehvW/images/moengage_6c5271.png?fit=max&auto=format&n=WqoTjr4uhFcFehvW&q=85&s=cfe1f344f6f2b65569c53979402890ae" 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-unity-sdk-initialization-split/lGL78K6d2VV03Hy7/images/moengage_8c6d4d.png?fit=max&auto=format&n=lGL78K6d2VV03Hy7&q=85&s=f79838343f2549cc7b06d5d320a9e84d" 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-unity-sdk-initialization-split/tQCtKybxhIpS45nc/images/moengage_241f44.png?fit=max&auto=format&n=tQCtKybxhIpS45nc&q=85&s=742b36f75e9ba574d169cbc1cdfe1fb0" 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-unity-sdk-initialization-split/AGphINogzEr7dJkJ/images/moengage_e1336f.png?fit=max&auto=format&n=AGphINogzEr7dJkJ&q=85&s=3f1e2e7195b7a768b79efb988629b0dc" alt="debug.png" width="1750" height="556" data-path="images/moengage_e1336f.png" />

   <img src="https://mintcdn.com/moengage-unity-sdk-initialization-split/iLc38Cclwkvn6zmu/images/moengage_585502.png?fit=max&auto=format&n=iLc38Cclwkvn6zmu&q=85&s=cf70bc77e4165c2a6e493fb0b445d67c" alt="target.png" width="1832" height="446" data-path="images/moengage_585502.png" />

   <img src="https://mintcdn.com/moengage-unity-sdk-initialization-split/mKv_oylg_NNQ7Lsq/images/moengage_2f8b4e.png?fit=max&auto=format&n=mKv_oylg_NNQ7Lsq&q=85&s=690d6883d37fe8154858b098fd9c7855" alt="duplicate.png" width="1826" height="976" data-path="images/moengage_2f8b4e.png" />
