Closed darnfish closed 11 months ago
Hi @darnfish
Thanks for reaching out and apologies for the inconvenience caused. To better assist you with displaying rich push notifications using both plugins, I have a few questions. Could you please tell me: When you run both plugins in your app, does OneSignal
attempt to create a new target or add the files to the target that customerio-expo-plugin
creates ?
Yeah exactly, that's the issue. I used patch-package
to rename every instance of NotificationService to CIONotificationService and the build went through successfully. Here is the patch I created: https://gist.github.com/darnfish/a93abf72fc1bacd453dad778dd149e7c.
This was the CI error when this issue was occurring:
Generating Pods project
[!] An error occurred while processing the post-install hook of the Podfile.
[Xcodeproj] Consistency issue: no parent for object `NotificationService.m`: `SourcesBuildPhase`, `SourcesBuildPhase`
/Users/expo/.gems/arm64/gems/xcodeproj-1.23.0/lib/xcodeproj/project/object/helpers/groupable_helper.rb:19:in `parent'
/Users/expo/.gems/arm64/gems/xcodeproj-1.23.0/lib/xcodeproj/project/object/build_file.rb:77:in `ascii_plist_annotation'
/Users/expo/.gems/arm64/gems/xcodeproj-1.23.0/lib/xcodeproj/project.rb:297:in `block in to_ascii_plist'
/Users/expo/.gems/arm64/gems/xcodeproj-1.23.0/lib/xcodeproj/project.rb:296:in `each'
/Users/expo/.gems/arm64/gems/xcodeproj-1.23.0/lib/xcodeproj/project.rb:296:in `to_ascii_plist'
/Users/expo/.gems/arm64/gems/xcodeproj-1.23.0/lib/xcodeproj/project.rb:365:in `block in save'
/Users/expo/.gems/arm64/gems/atomos-0.1.3/lib/atomos.rb:21:in `block in atomic_write'
/opt/homebrew/Cellar/ruby@2.7/2.7.8_1/lib/ruby/2.7.0/tempfile.rb:291:in `open'
/Users/expo/.gems/arm64/gems/atomos-0.1.3/lib/atomos.rb:17:in `atomic_write'
/Users/expo/.gems/arm64/gems/xcodeproj-1.23.0/lib/xcodeproj/project.rb:364:in `save'
/Users/expo/workingdir/build/node_modules/react-native/scripts/cocoapods/utils.rb:67:in `block in exclude_i386_architecture_while_using_hermes'
/Users/expo/workingdir/build/node_modules/react-native/scripts/cocoapods/utils.rb:62:in `each'
/Users/expo/workingdir/build/node_modules/react-native/scripts/cocoapods/utils.rb:62:in `exclude_i386_architecture_while_using_hermes'
/Users/expo/workingdir/build/node_modules/react-native/scripts/react_native_pods.rb:242:in `react_native_post_install'
/Users/expo/workingdir/build/ios/Podfile:64:in `block (3 levels) in from_ruby'
/Users/expo/.gems/arm64/gems/cocoapods-core-1.12.1/lib/cocoapods-core/podfile.rb:196:in `post_install!'
/Users/expo/.gems/arm64/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:1013:in `run_podfile_post_install_hook'
/Users/expo/.gems/arm64/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:1001:in `block in run_podfile_post_install_hooks'
/Users/expo/.gems/arm64/gems/cocoapods-1.12.1/lib/cocoapods/user_interface.rb:149:in `message'
/Users/expo/.gems/arm64/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:1000:in `run_podfile_post_install_hooks'
/Users/expo/.gems/arm64/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:337:in `block (2 levels) in create_and_save_projects'
/Users/expo/.gems/arm64/gems/cocoapods-1.12.1/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in `write!'
/Users/expo/.gems/arm64/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:336:in `block in create_and_save_projects'
/Users/expo/.gems/arm64/gems/cocoapods-1.12.1/lib/cocoapods/user_interface.rb:64:in `section'
/Users/expo/.gems/arm64/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:315:in `create_and_save_projects'
/Users/expo/.gems/arm64/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:307:in `generate_pods_project'
/Users/expo/.gems/arm64/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:183:in `integrate'
/Users/expo/.gems/arm64/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:170:in `install!'
/Users/expo/.gems/arm64/gems/cocoapods-1.12.1/lib/cocoapods/command/install.rb:52:in `run'
/Users/expo/.gems/arm64/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Users/expo/.gems/arm64/gems/cocoapods-1.12.1/lib/cocoapods/command.rb:52:in `run'
/Users/expo/.gems/arm64/gems/cocoapods-1.12.1/bin/pod:55:in `<top (required)>'
/Users/expo/.gems/arm64/bin/pod:25:in `load'
/Users/expo/.gems/arm64/bin/pod:25:in `<main>'
Thank you for bringing this issue to our attention, @darnfish. Appreciate it!
Unfortunately, the solution to your problem is more complex then us renaming a file in the Expo plugin. If we were to perform this file rename, you may be able to compile your app successfully, but we anticipate that your app would not fully function at runtime as expected.
The problem stems from a limitation in iOS that only 1 NotificationService (NSE) target is used within an app. So, you would either need to choose OneSignal or Customer.io to create a NotificationService and not the other. If you had 2+ NSE targets compiled in your app, the app would compile, but at runtime, you would see inconsistent results where sometimes an image would appear in a push notification and sometimes it would not. iOS randomly picks 1 NSE at runtime to execute and not the others.
There are some ways around this limitation to allow both services to work together. This, however, does require manually modifying native files in your iOS project that Expo generates. Because you use Expo, I am going to assume that you would not be able to modify native files in your iOS project.
I have logged this as an internal feature request - to allow our SDK to work alongside other SDKs with NotificationService targets in Expo. I am not able to give you a timeline on when to expect this feature at this time.
We are happy to help answer more questions for you if you have them. Sorry that this issue is a complex one.
Have an awesome day.
Thank you for this! I had no idea. My team is currently in the works of migrating off've OneSignal to CIO, so we'll remove the OneSignal NSE soon. Appreciate the help :~)
I'm encountering issues using this Expo plugin in parallel with OneSignal's Expo plugin, most notibly because both libraries use
NotificationService
as the name of the Objective C class. Do you know if it's possible to rename to CIONotificationService to avoid conflicts with OneSignal / any other config plugins?