无法在通知服务扩展中使用 pod

nab*_*abu 6 iphone ios cocoapods swift moengage

我正在创建一个通知扩展,按照规范添加目标并在其中添加一个 pod,如下所示:

步骤1 :

target 'MyProject' do

   # Integration - Frameworks
   pod 'Fabric'
        pod 'Crashlytics'
        pod 'MORichNotification'
   end


target 'NotificationServices' do
    pod 'MORichNotification'
end
Run Code Online (Sandbox Code Playgroud)

步骤:2 将“MORichNotification.h”导入到我的项目桥头文件中。

现在我想MORichNotification在我的班级中使用班级NotificationService,它显示以下错误。 在此输入图像描述

我尝试使用“清理项目”、“重新启动”、“擦除 DerivedData”,但没有任何改变。

Che*_*C D 2

首先,MORichNotification 仅适用于通知服务扩展,我可以从您的 podfile 中看到您也将其包含在应用程序的目标中。

而且,仅当您在应用程序中使用MoEngage-iOS-SDK时,您才可以使用 MORichNotifications,因为它只会处理通过 MoEngage 发送的通知。

现在,请按照以下步骤使用 MORichNotifications :

  1. 在通知服务扩展中安装 MORichNotification pod。请确保您使用的是 1.1.1 版本。
  2. 将桥接标头添加到您的通知服务扩展 在此输入图像描述
  3. 在 Bridging Header 中导入 MORichNotification 如下图所示:

在此输入图像描述

  1. 在通知服务扩展中使用 MORichNotification,如下所示: 在此输入图像描述 如果您仍然遇到任何问题,请告诉我。