> ## Documentation Index
> Fetch the complete documentation index at: https://moengage-user-guide.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?

## 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-user-guide/Qp4QqKVoi4FfGewy/images/moengage_381db3.png?fit=max&auto=format&n=Qp4QqKVoi4FfGewy&q=85&s=4aeb5830032b8207dd95a04b16e37b6d" 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-user-guide/dli7Axk8_KnXeLex/images/moengage_6dbf7c.png?fit=max&auto=format&n=dli7Axk8_KnXeLex&q=85&s=d122a3e3e2f84cf7018f2370196c8755" 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-user-guide/HrJ-EUE8JNklleVA/images/moengage_cfae58.png?fit=max&auto=format&n=HrJ-EUE8JNklleVA&q=85&s=890ff28e1cbc5686b96e5bd59e01c655" 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-user-guide/8iz16AheqipjeI8D/images/moengage_1c1516.png?fit=max&auto=format&n=8iz16AheqipjeI8D&q=85&s=aa23c778ffbda2fb7131d46a5a1784bb" 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-user-guide/Nc7DGgqNAva2wV7W/images/moengage_6c5271.png?fit=max&auto=format&n=Nc7DGgqNAva2wV7W&q=85&s=183ef288227de7ae8de08916d0e338ec" 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-user-guide/eI98be5uTx7OhSec/images/moengage_8c6d4d.png?fit=max&auto=format&n=eI98be5uTx7OhSec&q=85&s=e55f24a27ddd8362a18497bd312bf175" 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-user-guide/bf3rBsH0ybQ_mM3n/images/moengage_241f44.png?fit=max&auto=format&n=bf3rBsH0ybQ_mM3n&q=85&s=5a61f4eeed8c63296d84170c7195faa2" 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-user-guide/DfjER0fx7ZrT4EDG/images/moengage_e1336f.png?fit=max&auto=format&n=DfjER0fx7ZrT4EDG&q=85&s=2efe4fe5c2aea6001776286af02a8419" alt="debug.png" width="1750" height="556" data-path="images/moengage_e1336f.png" />

   <img src="https://mintcdn.com/moengage-user-guide/og_IWyLOPeLfVvWp/images/moengage_585502.png?fit=max&auto=format&n=og_IWyLOPeLfVvWp&q=85&s=1b81d1256671631aa6d926e92953accb" alt="target.png" width="1832" height="446" data-path="images/moengage_585502.png" />

   <img src="https://mintcdn.com/moengage-user-guide/yi5V3luA_EgtY7FG/images/moengage_2f8b4e.png?fit=max&auto=format&n=yi5V3luA_EgtY7FG&q=85&s=b60321df11fc9af34ed52f68ac00bf8b" alt="duplicate.png" width="1826" height="976" data-path="images/moengage_2f8b4e.png" />
