Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
anilslabs opened this issue Jul 25, 2023 · 7 comments

Comments

@anilslabs
Copy link

anilslabs commented Jul 25, 2023

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.

@LucasReinaldo
Copy link

any luck? 😄

@awaisjamil-mp
Copy link

any solution??

@takanamishi
Copy link

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!

@LkyYuen
Copy link

LkyYuen commented Jan 31, 2024

any solution???

@FullstackWEB-developer
Copy link

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

@BishalftSaikia
Copy link

BishalftSaikia commented Apr 3, 2024

  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 :: OneSignal/OneSignal-iOS-SDK#324 (comment)

@dawiddszewczyk
Copy link

Any solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants