无法在通知服务扩展中使用pod
我正在创build一个通知扩展,按照标准添加了目标,并在其中添加了一个窗格,如下所示:
步骤1 :
target 'MyProject' do # Integration - Frameworks pod 'Fabric' pod 'Crashlytics' pod 'MORichNotification' end target 'NotificationServices' do pod 'MORichNotification' end
步骤:2将 “MORichNotification.h”导入到我的项目桥头文件中。
现在我想在我的NotificationService
类中使用MORichNotification
类,它显示下面的错误。
我尝试了干净的项目,重新启动,擦拭DerivedData,但没有任何改变。
首先,MORICHNotification仅用于通知服务扩展,我可以从你的pod文件中看到,你也将它包含在你的应用程序的目标中。
只有在您的应用程序中使用MoEngage-iOS-SDK时 ,您才可以使用MORICHNotifications,因为它只处理通过MoEngage发送的通知。
现在,按照以下步骤使用MORICHNotifications:
- 在通知服务扩展中安装MORichNotification窗格。 请确保您使用的是1.1.1版本。
- 将桥接标题添加到您的通知服务扩展
- 在桥接头中导入MORICHNotification,如下图所示:
- 在您的通知服务扩展中使用MORICHNotification,如下所示: 让我知道如果你仍然面临任何问题。
您必须在“构build设置”中添加桥接头文件。 我能够使用'MORICHNotification'执行以下步骤。
- 将条目添加到Podfile
target "SOFAnswers" do pod 'MORichNotification' end
-
Pod安装
-
用下面的内容用
PROJECT_NAME-Bridging-Header.h
创build一个桥接头文件。
#ifndef SOFAnswers_Bridging_Header_h #define SOFAnswers_Bridging_Header_h #import <MORichNotification/MORichNotification.h> #endif /* SOFAnswers_Bridging_Header_h */
- 在生成设置中configuration桥接头。 (见附件)
- 使用MORICHNotification.h
谢谢,Sriram