5

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. enter image description here

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

KSR
  • 1,699
  • 15
  • 22
nabu
  • 552
  • 5
  • 16

2 Answers2

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)

enter image description here

  1. Use MORichNotification.h

enter image description here

Thanks, Sriram

Sri
  • 1,317
  • 9
  • 13
  • R u using swift 3.0? – Sahil Jan 04 '17 at 11:51
  • Yes Sahil I'm using 3.0, with latest XCode and iOS 10.2 – Sri Jan 04 '17 at 11:55
  • Nice. hope this help nabu. – Sahil Jan 04 '17 at 11:57
  • @Sri Still, you are trying to use it in your app. Now, try to create a notificationservice using this : [link](http://docs.moengage.com/docs/ios-10-rich-notifications) and follow the steps. let me know whether you are facing the same issue or not. – nabu Jan 04 '17 at 13:48
2

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 enter image description here
  3. Import MORichNotification in Bridging Header as shown in the image below:

enter image description here

  1. Use MORichNotification in your Notification Service Extension as shown below : enter image description here Let me know if still you are facing any issue.
Chengappa C D
  • 1,841
  • 1
  • 12
  • 19
  • Thanks that worked. My project gets compiled successfully. But still, when I run the app, MoEngage shows me the error : " Could not find a storyboard named 'MOInbox' in bundle NSBundle". – nabu Jan 05 '17 at 07:40
  • @nabu Which version of MoEngage iOS SDK you are using? And can you check and let me know if the storyboard file is present in the pod . refer -> https://i.stack.imgur.com/E0gpN.png – Chengappa C D Jan 05 '17 at 08:06
  • @ Chengappa C D I am using MoEngage-iOS-SDK 3.2.1, and storyboard is presented in pod resources. – nabu Jan 05 '17 at 08:19
  • @nabu : Check the link and make sure you have integrated MoEngage iOS SDK properly - > http://docs.moengage.com/docs/sdk-integration#section-integration-through-cocoapods – Chengappa C D Jan 05 '17 at 08:39
  • @nabu : I have released MoEngage-iOS-SDK version 3.2.2 with fix for MOInbox storyboard issue. Please update the SDK and let me know if still facing this issue. – Chengappa C D Jan 09 '17 at 13:01
  • Awesome - Thank you so much! – Henry Heleine Apr 13 '17 at 20:03