customerio / customerio-reactnative

MIT License
25 stars 11 forks source link

No such module 'ExpoModulesCore'. Trying to Configure NotificationServiceExtension with Two targets i.e. Production and Development #264

Closed teefortayyab closed 4 months ago

teefortayyab commented 5 months ago

SDK version: 3.7.0

Are logs available?

Screenshot 2024-04-30 at 1 02 30 AM

Describe the issue I am trying to add NotificationExtensionService to two environments in my react native app. I have two Targets and I have configured two NotificationExtensionService. I have integrated everything correctly but on development, it's not working. but on production, it's building the app.

Here's my Podfile.

  use_modular_headers!
  use_expo_modules!
  config = use_native_modules!

  use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
  use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']

  # Flags change depending on the env values.
  flags = get_default_flags()
  pod 'customerio-reactnative/apn', :path => '../node_modules/customerio-reactnative'

  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes',
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/..",
    # Note that if you have use_frameworks! enabled, Flipper will not work if enabled
    :flipper_configuration => flipper_config
  )

  pre_install do |installer|
    installer.pod_targets.each do |pod|
      if pod.name.start_with?("Firebase")
        def pod.build_type;
          Pod::BuildType.dynamic_framework
        end

        pod.recursive_dependent_targets.each do |dep_pod|
          def dep_pod.build_type;
            Pod::BuildType.dynamic_framework
          end
        end
      end
    end
  end

  post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)

    # This is necessary for Xcode 14, because it signs resource bundles by default
    # when building for devices.
    installer.target_installation_results.pod_target_installation_results
      .each do |pod_name, target_installation_result|
      target_installation_result.resource_bundle_targets.each do |resource_bundle_target|
        resource_bundle_target.build_configurations.each do |config|
          config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
          config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
        end
      end
    end
  end

  post_integrate do |installer|
    begin
      expo_patch_react_imports!(installer)
    rescue => e
      Pod::UI.warn e
    end
  end
end

target 'highrewards-development' do
  pod 'customerio-reactnative/apn', :path => '../node_modules/customerio-reactnative'
  inherit! :search_paths
  end

target 'NotificationServiceExtension' do
  # Notice the '-richpush' in the line below. This line of code is different from what you added for your main target.
  pod 'customerio-reactnative-richpush/apn', :path => '../node_modules/customerio-reactnative'
end

target 'NotificationServiceExtensionDevelopment' do
  # Notice the '-richpush' in the line below. This line of code is different from what you added for your main target.
  pod 'customerio-reactnative-richpush/apn', :path => '../node_modules/customerio-reactnative'
end

Additional context For now, I created two NotificationExtensionServices and configured them separately which is not working fine. How can I configure one notificationextensionservice to two targets so that It can work on Both Environment targets created in my project?

It's really urgent as we are stuck over this. Thanks.

teefortayyab commented 5 months ago

@mrehan27 @Shahroz16 guidance over this? I'd greatly appreciate if there's any workaround to configure customer.io NotificationExtensionService with Two targets on iOS (Using React Native).

ami-aman commented 5 months ago

Hey @teefortayyab thanks for reaching out.

To help you out further, I would like to learn about use case of having multiple notification service extensions. It might be technically possible to have multiple NSEs but it not recommended to use two or more notification service extensions in one app considering it's complexity, functionality and performance.

While I am not entirely clear how Customer.io's SDKs are tied to this issue. Perhaps by sharing some more details, we can work together to identify the connection with our dependency.

ami-aman commented 4 months ago

Closing this issue due to inactivity.