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

No such module 'OneSignal' #1370

Closed
schoenbl opened this issue Mar 11, 2022 · 17 comments
Closed

No such module 'OneSignal' #1370

schoenbl opened this issue Mar 11, 2022 · 17 comments

Comments

@schoenbl
Copy link

Description:

This is listed as a common issue: https://documentation.onesignal.com/docs/troubleshooting-ios

Resources that I have found have not been able to solve the issue. I've searched online and through the prior issues that people have listed on github.

In OneSignalNotificationServiceExtension, I receive the error: No such module 'OneSignal'
Screen Shot 2022-03-10 at 7 39 22 PM

Environment

I am running Xcode 13.2.

I installed through npm:

"react-native-onesignal": "^4.3.7",

This is my podfile:

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

platform :ios, '11.0'

target 'PodApp' do
  target 'OneSignalNotificationServiceExtension' do
    pod 'OneSignalXCFramework', '>= 3.0', '< 4.0'
  end
  ...
end

Steps to Reproduce Issue:
I followed the React Native SDK Setup: https://documentation.onesignal.com/docs/react-native-sdk-setup

@ekediala
Copy link

Hi. Trust you are well. Did you find a solution to this? I have the same problem and I can't find a solution that works.

@jesse-savary
Copy link

jesse-savary commented Mar 16, 2022

Also running into this after weeks of running this lib without issue. The error fully blocked our build process and unfortunately I had to remove OneSignal entirely. Would greatly appreciate a fix.

Edit: things are working now but unfortunately I can't pinpoint what changed -- moving forward cautiously but concerned this bug will break things when moving into prod

@schoenbl
Copy link
Author

I haven't found a solution. I've been sending message with their support, and they sent this:

When updating to the major release version of our SDK it does have some breaking changes.

We have step by step migration guides here that should explain the change https://documentation.onesignal.com/docs/mobile-2020-api-migration-guide

I tried what is in the documentation, but there may have been other issues wrong as well; they said that the target should not be added into the react native target, and instead be added by itself.

I moved on to using firebase, but I may try and see if some of the other feedback they gave works. It's pretty frustrating.

@ekediala
Copy link

ekediala commented Mar 16, 2022

I haven't found a solution. I've been sending message with their support, and they sent this:

When updating to the major release version of our SDK it does have some breaking changes.

We have step by step migration guides here that should explain the change https://documentation.onesignal.com/docs/mobile-2020-api-migration-guide

I tried what is in the documentation, but there may have been other issues wrong as well; they said that the target should not be added into the react native target, and instead be added by itself.

I moved on to using firebase, but I may try and see if some of the other feedback they gave works. It's pretty frustrating.

Thanks a lot. I removed all traces of OneSignal and redid the process in the documentation. It worked the second time.

@carolvalenca
Copy link

Same problem here, I followed the OneSignal documentation step by step but couldn't build my app yet!

@jesse-savary
Copy link

In my case this error appears to be related to my M1 Mac; I solved the issue by modifying my project.pbxproj:

change:

"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "i386";

to:

"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 i386";

Not a huge fan of this as AFAIK it forces my iOS simulator to use Rosetta when running my app but at least things are building.

@JuanpaG94
Copy link

In my case the error was M1 Mac arm architecture too.

In addition to this, @jesse-savary's comment is correct and is in fact one of the necessary steps to achieve OneSignal (or another Pod with the same issue) to compile, but I needed to add a post_install script into Podfile which force every single Pod to target x86_64 architecture on compilation, and this config is not available via project.pbxproj file so this post_install script is crucial.

This additional last step was necessary for me in order to make my project to compile.

You simple need to add this to your Podfile:

target 'YourApp' do
  # ... all your dependencies etc.

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        # Force CocoaPods targets to always build for x86_64
        config.build_settings['ARCHS[sdk=iphonesimulator*]'] = 'x86_64'
      end
    end
  end

end

There's an alternative to EXCLUDED_ARCHS which is not excluding architectures BUT limiting 'Any iOS Simulator SDK' to just be x86_64 so you don't need to exclude archs by limiting them to the only compatible one.
You can do this by adding this into project.pbxproj:

"ARCHS[sdk=iphonesimulator*]" = x86_64; (or configuring it via Xcode UI).

All this information was extracted from this blog post(which saved my life), and explains everything in a very clear and direct way: https://blog.sudeium.com/2021/06/18/build-for-x86-simulator-on-apple-silicon-macs/

Of course this will forcing Simulator to run with Rosetta but there's no alternative which works in the time I'm writting this. This solution applies to every arm Apple Silicon: M1, M1 Pro/Max/Ultra.

Happy coding! 🚀

@rgomezp
Copy link
Contributor

rgomezp commented Jun 3, 2022

Duplicate of #1260

@rgomezp rgomezp marked this as a duplicate of #1260 Jun 3, 2022
@rgomezp rgomezp closed this as completed Jun 3, 2022
@Ebeldev
Copy link

Ebeldev commented Jul 12, 2022

@rgomezp I do not see how this is a duplicate of #1260 ?

People are talking about M1 chips.. I'm on Intel chips and I do have the same no such module error.

And in both issues. There is not a proper and clean response how to fix this.

It's been more then a year.

@Ebeldev
Copy link

Ebeldev commented Jul 13, 2022

I was able to get ride of the error.

What I did you may ask !! .

I use to open xcodeproj file but instead open xcworkspace file and it worked.

@GSFZamai
Copy link

I was able to get ride of the error.

What I did you may ask !! .

I use to open xcodeproj file but instead open xcworkspace file and it worked.

Worked for me too.

@zdziczkowski
Copy link

That's weird @Ebeldev and @GSFZamai ... everything we have learned says that is bad. Haha. Sadly, this did not work for me but I may be suffering from a separate issue.

@Seamus1989
Copy link

on an M1 and I'm attempting to build an archive, I can build the app on my machine and run but cannot archive. All solutions including the above have failed.

@milobob
Copy link

milobob commented Jan 10, 2023

after seeing Xcode give the No such module 'OneSignal' error, what worked for me is:

  1. use terminal and run pod deintegrate and then pod install
  2. use terminal to install npm install
  3. use terminal and run react-native run-ios --device to load it onto my device
  4. reload the project in xcode and all is well in the world
  5. ...
  6. profit

maybe xcode compiles differently than the react-native run-ios --device compilation method... not sure but it works now!

@arys
Copy link

arys commented Mar 5, 2023

if someone is facing this issue after installing watermelon db and have set use_frameworks option in podfile, try to install watermelon libs from static library.

  $static_framework = [ 
    'WatermelonDB',
    'simdjson',
  ]

  pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
    installer.pod_targets.each do |pod|
      if $static_framework.include?(pod.name)
        def pod.build_type;
          Pod::BuildType.static_library # >= 1.9
          # Pod::Target::BuildType.static_library #  pods version < 1.9
        end
      end
    end
  end

source Nozbe/WatermelonDB#1285 (comment)

@mathbalduino
Copy link

Well, I'm having this issue, right now. Already tried a lot of different solutions, none worked. Does anyone else is experiencing this issue too?

@sanny-naked
Copy link

I encountered this issue yesterday when trying to build a target that was a duplicate of another one. This target was not present in our podfile. I created a shared config for the targets to use and the error went away.

def sharedConfig
   config goes here
end

def sharedOneSignal
   config goes here
end

target 'Target'
   sharedConfig
end

target 'Target Clone'
   sharedConfig
end

target 'OneSignalNotificationServiceExtension' do
   sharedOneSignal
 end
 
 target 'OneSignalNotificationServiceExtensionClone' do
   sharedOneSignal
 end

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