Unable to use pod in Notification service extension

与世无争的帅哥 提交于 2019-12-10 18:23:36

问题


I am creating a Notification extension, added target as per norm and added a pod in it as follows:

Step 1 :

target 'MyProject' do

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


target 'NotificationServices' do
    pod 'MORichNotification'
end

Step : 2 Import "MORichNotification.h" into my Project bridge header file.

Now I want to use MORichNotification class in my NotificationService class, and it shows below error.

I tried with Clean project, Restarted, Wiped DerivedData, but nothing changed.


回答1:


First of all MORichNotification is meant only for the Notification Service Extension, I can see from your podfile that you are including it in your app's target too.

And also you can use MORichNotifications, only if you are using MoEngage-iOS-SDK in your app, as it will process only the notifications sent via MoEngage.

Now, follow the below steps to use MORichNotifications :

  1. Install the MORichNotification pod in your Notification Service Extension. And please make sure that you are using version 1.1.1.
  2. Add Bridging Header to your Notification Service Extension
  3. Import MORichNotification in Bridging Header as shown in the image below:

  1. Use MORichNotification in your Notification Service Extension as shown below : Let me know if still you are facing any issue.



回答2:


You have to add your bridging header file on 'Build Settings'. I was able to use 'MORichNotification' doing the following steps.

  1. Add entry to Podfile

target "SOFAnswers" do pod 'MORichNotification' end

  1. Pod Install

  2. Create a Bridging header file with PROJECT_NAME-Bridging-Header.h with below contents.

#ifndef SOFAnswers_Bridging_Header_h
#define SOFAnswers_Bridging_Header_h
#import <MORichNotification/MORichNotification.h>
#endif /* SOFAnswers_Bridging_Header_h */
  1. Configure the bridging header in build settings. (see attachment)

  1. Use MORichNotification.h

Thanks, Sriram



来源:https://stackoverflow.com/questions/41462090/unable-to-use-pod-in-notification-service-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!