React-native-onesignal: Cocoapods x OneSignal x React-Native 0.57 build error

Created on 28 Nov 2018  路  2Comments  路  Source: OneSignal/react-native-onesignal

Description:

After installing react-native-onesignal on a existing project i got this error when building:

ld: framework not found React clang: error: linker command failed with exit code 1 (use -v to see invocation)

Environment

I use the latest version of OneSignal available from react-native-onesignal (3.2.8) and i use react-native 0.57.4.

I added the SDK using npm install react-native-onesignal, react-native link, and because i'm using CocoaPods, i went to the folder ios and did pod install. I added following lines in my Podfile because else there was an error:

pre_install do |installer|

Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
end

The 'Pods-PROJECTNAME' target has transitive dependencies that include static binaries: (/Users/valdomar/Projects/PROJECTNAME/App/ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework/OneSignal.framework)

Steps to Reproduce Issue:

  1. Install the OneSignal SDK using npm and cocoapods into your project
  2. Try to compile

Anything else:

Here is my Podfile:

platform :ios, '12.0'
use_frameworks!
pre_install do |installer|
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
end
target 'PROJECTNAME' do
    pod 'SnapSDK'
  pod 'react-native-onesignal', :path => '../node_modules/react-native-onesignal'

end

I already used OneSignal for another project on ReactNative and never got this problem, i tried a lot of different methods to fix it, but none has worked... I was not experiencing this issue in previous version of react-native, but i think it is beacause i was not using Cocoapods :(

All 2 comments

@Valdomar when you are posting your podfile please make sure to post it as a code block using 3 backticks.

The transitive dependencies error is something we鈥檙e working on and for now it can be ignored.

As far as the build error you鈥檙e getting, it鈥檚 not related to our SDK so I鈥檓 afraid there鈥檚 not much I can do to help

Sorry for the format, i edited.

Well this issue is related to react-native-onesignal as I don鈥檛 have this issue without it, and it鈥檚 your podsec file that require the React framework (and my project was building well without it). Also by requiring React as a Pod dependencies you are adding a different version of React in the project and it鈥檚 making conflict when you try to build js in the node packager saying there is two version of React one in node_modules and one in the Pod/React/... something like that (sorry not in front of my computer). I think the issue is yout setup with CocoaPods as in previous use of react-native-onesignal, i never used CocoaPods I think, maybe you have a doc to install it without it.

EDIT: Well, the issue is related to react-native-onesignal, has you can't use it if you already have CocoaPods depencies. I had to move my Podfile, npm i react-native-onesignal --save && react-native link, and after that, put back my Podfile, did pod install (to install my other dependencies) and after that you can build successfully. "It's not related to our SDK". Haha.

Was this page helpful?
0 / 5 - 0 ratings