Flutter OneSignal setup on iOS with multiple flavors

133 Views Asked by At

I am using Flutter flavors to manage same code base for multiple apps. So far flavor works pretty good. However, I am having difficulty in settting up OneSignal for each flavors for iOS. Lets say I have flavor1 and flavor2.

I have followed OneSignal's documentation https://documentation.onesignal.com/docs/flutter-sdk-setup . It does work for main flavor (i.e. flavor1) and doesn't for other flavor (flavor2).

What i tried.

For flavor1.

  1. I added new target with name "OneSignalNotificationServiceExtension".
  2. I specified bundle id for this target as "com.myapp.flavor1.OneSignalNotificationServiceExtension"
  3. I updated NotificationService.m file as per documentation.
  4. I updated podfile as well.

So far this works for flavor1.

But for flavor2.

  1. I added new target with name "OneSignalNotificationServiceExtension". It didn't let me add because target name was already taken.
  2. I added with name "FlavorTwoOneSignalNotificationServiceExtension".
  3. I specified bundle id for this target as "com.myapp.flavor2.FlavorTwoOneSignalNotificationServiceExtension"
  4. I updated NotificationService.m file as per documentation.

When i ran the app from Xcode. i get error "No such module 'OneSignalExtension'" under FlavorTwoOneSignalNotificationServiceExtension.

Can anybody point out what I am doing wrong here?

Thanks

0

There are 0 best solutions below