Reputation: 164
I'm currently trying to add OneSignal to my react native expo (bare) IOS build and have followed OneSignal's guide as shown here: https://documentation.onesignal.com/docs/react-native-sdk-setup
However, Xcode has flagged up a compiler error of: No such module 'OneSignal'
Here is my Podfile that includes the OneSignalXCFramework import:
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
require File.join(File.dirname(`node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`), "native_modules")
platform :ios, '12.0'
require 'json'
podfile_properties = JSON.parse(File.read('./Podfile.properties.json')) rescue {}
target '<NAME>' do
use_expo_modules!
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
:hermes_enabled => podfile_properties['expo.jsEngine'] == 'hermes'
)
# Uncomment to opt-in to using Flipper
#
# if !ENV['CI']
# use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1')
# end
post_install do |installer|
react_native_post_install(installer)
# Workaround `Cycle inside FBReactNativeSpec` error for react-native 0.64
# Reference: https://github.com/software-mansion/react-native-screens/issues/842#issuecomment-812543933
installer.pods_project.targets.each do |target|
if (target.name&.eql?('FBReactNativeSpec'))
target.build_phases.each do |build_phase|
if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
target.build_phases.move(build_phase, 0)
end
end
end
end
target.build_configurations.each do |config|
# some older pods don't support some architectures, anything over iOS 11 resolves that
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
post_integrate do |installer|
begin
expo_patch_react_imports!(installer)
rescue => e
Pod::UI.warn e
end
end
end
target 'OneSignalNotificationServiceExtension' do
pod 'OneSignalXCFramework', '>= 3.0', '< 4.0'
end
As a side note, I've already tried to add pod 'OneSignal'
or use_frameworks!
into the PodFile. Has anyone else experienced this issue before?
Upvotes: 11
Views: 6562
Reputation: 39
If you're like me and use an Apple Silicon Mac i.e M1/M2 and the Pros, you would need to turn on Rosetta. To do this, in your Xcode menu, select Product > Destination > Destination Architectures > Show Rosetta Destinations. Build in Rosetta after running the following command:
pod deintegrate && pod install
Upvotes: 0
Reputation: 737
In my case, which may not be the reason for many of you but may help someone, the first time I've added it, all works well, but after merging the code into my main branch I get this error. My problem was that I have added podfile
to .gitignore
so it was working the first time but after merging it, podfile of course doesn't have the needed last section which is
target 'OneSignalNotificationServiceExtension' do
pod 'OneSignalXCFramework', '>= 3.0', '< 4.0'
end
So make sure you have it.
Upvotes: 0
Reputation: 880
Xcode 14.0.1 update & Swift 5.7 - Using SPM(Swift Package Manager)
Recently I have integrated one signal into my project using SPM. it worked fine until I tried to upload the build to app store connect and it started showing me the same error. Here's how I fixed this issue.
Step 1: Removed the one signal dependency
Step 2:
added again one signal Notification framework as a dependency.
On the Choose package products popup.
Upvotes: 11