OneSignal-Flutter-SDK icon indicating copy to clipboard operation
OneSignal-Flutter-SDK copied to clipboard

Multiple schemes/flavours - Embedded binary's bundle identifier is not prefixed with the parent app's bundle identifier

Open anilslabs opened this issue 2 years ago β€’ 7 comments
trafficstars

I am trying to integrate the OneSignal SDK with a Flutter iOS app having multiple schemes or flavors, i.e., experimental and production. The configuration only works fine with the production scheme. Is there any guidance or documentation on how to configure OneSignal for multiple schemes?

For more configuration, we have different bundle identifiers for experimental and production. For production: com.xxxx.app For experimental: com.xxxx.app.exp

I tried creating separate targets for notification services extension i.e. OneSignalNotificationServiceExtension for production and ExpOneSignalNotificationServiceExtension for experimental which contains separate identifiers as prefix.

anilslabs avatar Jul 25 '23 09:07 anilslabs

any luck? πŸ˜„

LucasReinaldo avatar Dec 09 '23 15:12 LucasReinaldo

any solution??

awaisjamil-mp avatar Jan 11 '24 05:01 awaisjamil-mp

I'm not good at English, so please overlook any awkward sentences.

Following the setup guide at https://documentation.onesignal.com/docs/flutter-sdk-setup, proceed with configuring the Add App Groups option using the Optional method.

γ‚Ήγ‚―γƒͺγƒΌγƒ³γ‚·γƒ§γƒƒγƒˆ 2024-01-19 14 24 36

In the Info.plist of OneSignalNotificationServiceExtension, I want to add the following:

<key>OneSignal_app_groups_key</key>
<string>group.com.example$(appIdSuffix).onesignal</string>

However, since appIdSuffix is provided through dart-defines, the following steps are necessary:

Create a config file to use environment variables defined with dart-defines

γ‚Ήγ‚―γƒͺγƒΌγƒ³γ‚·γƒ§γƒƒγƒˆ 2024-01-19 14 13 08

Debug.xcconfig

#include? "Pods/Target Support Files/Pods-OneSignalNotificationServiceExtension/Pods-OneSignalNotificationServiceExtension.debug.xcconfig"
#include "../Flutter/Generated.xcconfig"

Release.xcconfig

#include? "Pods/Target Support Files/Pods-OneSignalNotificationServiceExtension/Pods-OneSignalNotificationServiceExtension.release.xcconfig"
#include "../Flutter/Generated.xcconfig"

Including "../Flutter/Generated.xcconfig" makes variables defined with dart-defines available!

Modify to load the created config file

γ‚Ήγ‚―γƒͺγƒΌγƒ³γ‚·γƒ§γƒƒγƒˆ 2024-01-19 14 16 52

Change the Configuration File in OneSignalNotificationServiceExtension to load the Debug.xcconfig and Release.xcconfig created.

Specify the Bundle Identifier of OneSignalNotificationServiceExtension

TARGETS -> OneSignalNotificationServiceExtension -> Build Settings Replace Product Bundle Identifier with com.example$(appIdSuffix).OneSignalNotificationServiceExtension

Add OneSignal_app_groups_key to Info.plist of OneSignalNotificationServiceExtension

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>NSExtension</key>
	<dict>
		<key>NSExtensionPointIdentifier</key>
		<string>com.apple.usernotifications.service</string>
		<key>NSExtensionPrincipalClass</key>
		<string>$(PRODUCT_MODULE_NAME).NotificationService</string>
	</dict>
	<key>OneSignal_app_groups_key</key>
	<string>group.com.example$(appIdSuffix).onesignal</string>
</dict>
</plist>

It seems to be working well with these settings!

takanamishi avatar Jan 19 '24 06:01 takanamishi

any solution???

LkyYuen avatar Jan 31 '24 09:01 LkyYuen

It's a bit complicated, but this seems to be the only way for now. Has anyone found a better way?

FullstackWEB-developer avatar Mar 01 '24 21:03 FullstackWEB-developer

  1. in oneSignal -> buildsettings define a user-define ->multiple values with all you env and bundleID, give it unique name, in my case BUNDLE_ID
  2. in project.pbxproj search and change all .OneSignalNotificationServiceExtension to => PRODUCT_BUNDLE_IDENTIFIER = "$(BUNDLE_ID).OneSignalNotificationServiceExtension";

bundleId

ref :: https://github.com/OneSignal/OneSignal-iOS-SDK/issues/324#issuecomment-475034377

BishalftSaikia avatar Apr 03 '24 05:04 BishalftSaikia

Any solution?

dawiddszewczyk avatar May 22 '24 14:05 dawiddszewczyk