Solvedreact native onesignal Unable to add Notification Service Extension
βοΈAccepted Answer
@jdegger that approach seems to have worked for me also, nice one
I used abstract_target
to tidy up my Podfile
slightly:
abstract_target 'MyAppAbstractTarget' do
pod 'React',
:path => "../node_modules/react-native",
:inhibit_warnings => true,
:subspecs => [
"Core",
"ART",
"RCTActionSheet",
"RCTAnimation",
"RCTCameraRoll",
"RCTGeolocation",
"RCTImage",
"RCTNetwork",
"RCTText",
"RCTVibration",
"RCTWebSocket",
"DevSupport",
"CxxBridge"
]
pod 'yoga',
:path => "../node_modules/react-native/ReactCommon/yoga",
:inhibit_warnings => true
pod 'DoubleConversion',
:podspec => "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec",
:inhibit_warnings => true
pod 'Folly',
:podspec => "../node_modules/react-native/third-party-podspecs/Folly.podspec",
:inhibit_warnings => true
pod 'glog',
:podspec => "../node_modules/react-native/third-party-podspecs/glog.podspec",
:inhibit_warnings => true
pod 'react-native-onesignal', :path => '../node_modules/react-native-onesignal'
post_install { |installer| perform_post_install_tasks(installer) }
target 'MyOneSignalNotificationsApp' do
pod 'ExpoKit',
:git => "http://github.com/expo/expo.git",
:tag => "ios/2.6.5",
:subspecs => [
"Core",
"CPP",
"GL"
],
:inhibit_warnings => true
end
target 'OneSignalNotificationServiceExtension'
end
I defined perform_post_install_tasks
as a separate method to tidy up the target block further, it contains the same auto-generated content as posted in @yirui94's earlier post
I then amended the Build Settings of my OneSignalNotificationServiceExtension target, setting both Search Paths > Header Search Paths and Search Paths > Library Search Paths to $(inherited)
.
In Build Phases, under Link Binary With Libraries, I removed all except:
I then ran pod install
, which links the pod libraries to both targets.
At this point, I was able to build successfully and send out notifications
Other Answers:
I seem to have fixed something similar by adding a target completely separate from my main target with all the react stuff included. Probably way too much, but I'm not sure what I can leave out at this point.
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'alarmPrototype' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
pod 'Firebase/Core'
# Your 'node_modules' directory is probably in the root of your project,
# but if not, adjust the `:path` accordingly
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge', # Include this for RN >= 0.47
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTText',
'RCTNetwork',
'RCTWebSocket', # needed for debugging
# Add any other subspecs you want to use in your project
]
# Explicitly include Yoga if you are using RN >= 0.42.0
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
# Third party deps podspec link
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/GLog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
# Pods for alarmPrototype
pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'
pod 'react-native-battery', :path => '../node_modules/react-native-battery'
pod 'RNI18n', :path => '../node_modules/react-native-i18n'
pod 'react-native-onesignal', :path => '../node_modules/react-native-onesignal'
# Calling
pod 'TwilioVoice', '~> 2.0.0'
pod 'RNTwilioVoice', :path => '../node_modules/react-native-twilio-programmable-voice'
pod 'ReactNativePermissions', :path => '../node_modules/react-native-permissions'
end
target 'OneSignalNotificationServiceExtension' do
# Pods for sevice extension
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge', # Include this for RN >= 0.47
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTText',
'RCTNetwork',
'RCTWebSocket', # needed for debugging
# Add any other subspecs you want to use in your project
]
# Explicitly include Yoga if you are using RN >= 0.42.0
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
# Third party deps podspec link
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/GLog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
# pods
pod 'react-native-onesignal', :path => '../node_modules/react-native-onesignal'
end
This is more of a problem with our documentation (for using OneSignal after detaching with Expo) than a bug with our SDK, sorry for the inconvenience this has caused you.
We'll update our documentation to better explain how the SDK should be used in Expo projects (which usually use Cocoapods to manage dependencies as opposed to React's more traditional Xcode sub-project model).
I'll mark this issue as resolved once I've updated our docs, also @yirui94 please let me know if the approach described above by @atothewest resolves the problem for you
Description:
On iOS I am able to setup the SDK to work with notifications, however, after adding the Notification Service Extension I run into an error, notably the
symbol(s) not found for architecture x86_64
found in the troubleshooting guide and several other issues opened here.My main issue is this: I can't add the frameworkπ€·ββοΈ
libRCTOneSignal.a
because it doesn't exist...? I think I am missing something here?Environment
npm install --save react-native-onesignal
react-native link react-native-onesignal
Steps to Reproduce Issue:
npm install
exp detach
npm install --save react-native-onesignal
react-native link react-native-onesignal
cd ios/
and runpod install
libRCTOneSignal.a
cannot be added to the framework since it is not found resulting in thesymbol(s) not found for architecture x86_64
build failed errorAnything else: