Description:
Followed the React Native & Expo SDK Setup guide. After completing step 5, I attempted to build my app in XCode. The build failed with the following error:
ld: library not found for -lreact-native-onesignal
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I tried following the manual linking steps but hit the same error. Wondering anyone figured out a solution to this?
Thanks!
Environment
yarn add react-native-onesignal
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 'OneSignalNotificationServiceExtension' do
pod 'OneSignal', '>= 3.0', '< 4.0'
end
target 'WellnessReactNative' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
pod 'Stripe', '~> 19.0.1'
pod 'tipsi-stripe', :path => '../node_modules/tipsi-stripe'
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
# use_flipper!
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'react-native-config'
phase = target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)
phase.shell_script = "cd ../../"\
" && RNC_ROOT=./node_modules/react-native-config/"\
" && export SYMROOT=$RNC_ROOT/ios/ReactNativeConfig"\
" && ruby $RNC_ROOT/ios/ReactNativeConfig/BuildDotenvConfig.ruby"
target.build_phases << phase
target.build_phases.move(phase,0)
end
end
# flipper_post_install(installer)
end
end
Steps to Reproduce Issue:
Follow the React Native & Expo SDK Setup guide
Howdy,
Try running pod deintegrate && pod install
from your ios
directory. If that doesn't work, try running a clean build. If none of those work, try deleting your Derived Data.
Hi @rgomezp,
Thanks for replying! I gave your suggestions a shot but encountered the same error.
I'm thinking at this point I need to link the library manually because the autolinking isn't working. I set up the manual linking after clearing everything. And I'm seeing the following error in RCTOneSignalExtensionService.m:
node_modules/react-native-onesignal/ios/RCTOneSignal/RCTOneSignalExtensionService.m:4:9: 'OneSignal.h' file not found
Checking out the "Frameworks" directory in the RCTOneSignal.xcodeproj
it seems like the OneSignal.h
reference is pointing to node_modules/react-native-onesignal/ios/OneSignal.h
. But this file doesn't exist. Could that be effecting the manual linking?
Any update on this ? Facing the same issue after updating to Xcode 12.
Hi @hugoh59,
The issue for me was that my Cocoapods didn't update my library search paths. Still not sure why...
I fixed my install by manually adding ${PODS_CONFIGURATION_BUILD_DIR}/react-native-onesignal
to the Library Search Paths (Build Settings > Search Paths > Library Search Paths) in my main target.
Hope this helps!