> ## Documentation Index
> Fetch the complete documentation index at: https://moengage-doc-2298-s2s-type-case-sensitive.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-doc-2298-s2s-type-case-sensitive/2juJZAT1rO-n85t1/images/moengage_381db3.png?fit=max&auto=format&n=2juJZAT1rO-n85t1&q=85&s=7317c3e756d74acc8ae4de3bf8b766c9" 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-doc-2298-s2s-type-case-sensitive/8OaIYgvqt-4jw66X/images/moengage_6dbf7c.png?fit=max&auto=format&n=8OaIYgvqt-4jw66X&q=85&s=675c154887f57f1273dc9eccb56eab4b" 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-doc-2298-s2s-type-case-sensitive/snQIRyrpzacZ3rp-/images/moengage_cfae58.png?fit=max&auto=format&n=snQIRyrpzacZ3rp-&q=85&s=9326f3f0e18e345f38642ed4fcb1330c" 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-doc-2298-s2s-type-case-sensitive/UqpZ5Z0TWMUJhlPT/images/moengage_1c1516.png?fit=max&auto=format&n=UqpZ5Z0TWMUJhlPT&q=85&s=51af21fb26052fda3a455a2e9dbc4792" 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-doc-2298-s2s-type-case-sensitive/8OaIYgvqt-4jw66X/images/moengage_6c5271.png?fit=max&auto=format&n=8OaIYgvqt-4jw66X&q=85&s=89e50328bd1bf55a3944c519f183dc25" 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-doc-2298-s2s-type-case-sensitive/IAtyeNXWnoyT8H1D/images/moengage_8c6d4d.png?fit=max&auto=format&n=IAtyeNXWnoyT8H1D&q=85&s=a43ca33588a9dc1ba3b7d8fdb707e652" 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-doc-2298-s2s-type-case-sensitive/yw34ddOKYE7OTIjD/images/moengage_241f44.png?fit=max&auto=format&n=yw34ddOKYE7OTIjD&q=85&s=827498ee43eac8cecc1e63b4674371ba" 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-doc-2298-s2s-type-case-sensitive/225iUySxCWRqtEV6/images/moengage_e1336f.png?fit=max&auto=format&n=225iUySxCWRqtEV6&q=85&s=baabc5fc9d88b10ebb5a9f67f48b4cee" alt="debug.png" width="1750" height="556" data-path="images/moengage_e1336f.png" />

   <img src="https://mintcdn.com/moengage-doc-2298-s2s-type-case-sensitive/yddM2Gw9NzXwsWtt/images/moengage_585502.png?fit=max&auto=format&n=yddM2Gw9NzXwsWtt&q=85&s=7f3e5d3bb37617b6dcb7590857d57bb5" alt="target.png" width="1832" height="446" data-path="images/moengage_585502.png" />

   <img src="https://mintcdn.com/moengage-doc-2298-s2s-type-case-sensitive/UYAHqCs6VaL856P3/images/moengage_2f8b4e.png?fit=max&auto=format&n=UYAHqCs6VaL856P3&q=85&s=40c1e41d4ffef93ade4c4b11a5206f94" alt="duplicate.png" width="1826" height="976" data-path="images/moengage_2f8b4e.png" />
