react-native-onesignal icon indicating copy to clipboard operation
react-native-onesignal copied to clipboard

[Bug]: OneSignalExtension No such module

Open phuvinhng opened this issue 1 year ago • 18 comments

What happened?

In project react native, I have installed OneSignalExtension. However, OneSignalExtension not found in file NotificationService

Steps to reproduce?

1. rm -rf Pods
2. rm -rf Podfile.lock
3. Clean project
4. rm -rf build folder ios

What did you expect to happen?

I expect app running

React Native OneSignal SDK version

5.2.2

Which platform(s) are affected?

  • [X] iOS
  • [ ] Android

Relevant log output

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

phuvinhng avatar Aug 09 '24 01:08 phuvinhng

Screenshot 2024-08-09 at 08 56 28

phuvinhng avatar Aug 09 '24 01:08 phuvinhng

+1

phithu avatar Aug 14 '24 11:08 phithu

+1

feliper-botelho avatar Aug 14 '24 17:08 feliper-botelho

+1

anasvemmully avatar Aug 15 '24 06:08 anasvemmully

Hi, can you share what you have in your Podfile?

nan-li avatar Aug 15 '24 19:08 nan-li

+1

matheusleite avatar Aug 19 '24 12:08 matheusleite

+1

ChoiHyeongu avatar Sep 10 '24 08:09 ChoiHyeongu

+1

andrzli avatar Sep 17 '24 02:09 andrzli

+1

davide-granello avatar Oct 15 '24 10:10 davide-granello

HELLO ALL

I have resolved this by updating pod file please update your Main target name

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
require_relative '../node_modules/react-native-permissions/scripts/setup'

platform :ios, '12.4'
install! 'cocoapods', :deterministic_uuids => false

production = ENV["PRODUCTION"] == "1"

target 'your_main_target' do
  config = use_native_modules!
  use_frameworks! :linkage => :static
  $RNFirebaseAsStaticFramework = true
  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  setup_permissions([
    'Camera',
    'LocationWhenInUse',
    'MediaLibrary',
    'Notifications',
    'PhotoLibrary',
    'PhotoLibraryAddOnly',
  ])
end

# OneSignal Notification Service Extension target
target 'OneSignalNotificationServiceExtension' do
  use_frameworks! :linkage => :static
  pod 'OneSignalXCFramework', '>= 5.0.0', '< 6.0'
end

# Combined post_install hook for both targets
post_install do |installer|
  # For DigilegalPro and general post install tasks
  react_native_post_install(installer)
  __apply_Xcode_12_5_M1_post_install_workaround(installer)

  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.4'
      config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
      
      # This setting is required for app extensions
      if target.name == 'OneSignalNotificationServiceExtension'
        config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'YES'
      end
    end
  end

  # Xcode 14 resource bundle signing fix
  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['CODE_SIGNING_ALLOWED'] = 'NO'
      end
    end
  end
end

Rohit-vinfotech avatar Oct 20 '24 07:10 Rohit-vinfotech

+1 this bug is blocking me from even building my app

aduca98 avatar Dec 03 '24 06:12 aduca98

I resolve this following this steps:

  1. In the project folder run: pod deintegrate pod install --repo-update
  2. Open the project in XCode and go to: Build > Clear All Issues Build > Clean Build Folder...

After these steps the error No such module 'OneSignalExtension' was resolved.

IronSantana avatar Dec 03 '24 14:12 IronSantana

I encountered the same issue and resolved it by following the Official OneSignal troubleshooting guide:

Steps:

  1. Remove the following code from the Podfile:
target 'OneSignalNotificationServiceExtension' do
  pod 'OneSignalXCFramework', '>= 5.0.0', '< 6.0'
end

target 'OneSignalNotificationServiceExtensionDev' do
  pod 'OneSignalXCFramework', '>= 5.0.0', '< 6.0'
end
  1. Add OneSignalCore.xcframework, OneSignalOutcomes.xcframework, and OneSignalExtension.xcframework to the Notification Service Extension target in Xcode.

sandipshiwakoti avatar Jan 21 '25 18:01 sandipshiwakoti

any update on this issue?

mowaisdinar avatar Feb 05 '25 13:02 mowaisdinar

@mowaisdinar did you try the recommendations suggested by @IronSantana and @sandipshiwakoti above?

nan-li avatar Feb 10 '25 22:02 nan-li

+1

stings8 avatar Mar 05 '25 23:03 stings8

+1, This error occurs when using 'ios 15.1'

sangjuun-park avatar Mar 10 '25 13:03 sangjuun-park

I figure it out. do not open the wrong project file.

Image

Coder7777 avatar Mar 13 '25 16:03 Coder7777

Yes make sure you open the .xcworkspace file in Xcode: https://documentation.onesignal.com/docs/react-native-sdk-setup#1-add-push-notifications-capability-to-app-target

I haven't heard any new updates since my last response (except the +1's to let us know you also experience this), closing this issue.

nan-li avatar Sep 12 '25 05:09 nan-li