Error compiling with React Native 0.61.0 with Xcode: "'React/RCTBridgeModule.h' file not found"
Closed this issue Β· 41 comments
My project stopped building as soon as I updated to the latest React Native version: 0.61.0. Had it working perfectly in 0.60.5 and lower.
Examining the error I notice this is probably related to the absence of node_modules/react-native/React.xcodeproj
since 0.61.0. As adding that file to the Libraries
folder in Xcode Γ‘nd using it as a Depedency
under Build Phases
did the trick in resolving the "'React/RCTBridgeModule.h' file not found" error in 0.60.5 and below. Also mentioned here.
Does anybody have an idea to get this to work again without React.xcodeproj
?
I already tried updating the header search paths. But that does not work:
$(inherited)
$(SRCROOT)/../node_modules/react-native-share-extension/ios
$(SRCROOT)/../node_modules/react-native/React
Error details:
/node_modules/react-native-share-extension/ios/ReactNativeShareExtension.h:2:9: 'React/RCTBridgeModule.h' file not found
react-native-share-extension/ios/ReactNativeShareExtension.h
#import <UIKit/UIKit.h>
#import <React/RCTBridgeModule.h>
@interface ReactNativeShareExtension : UIViewController<RCTBridgeModule>
- (UIView*) shareView;
@end
Fixed it by adding a .podspec
file in the root and treat the package as a pod dependency now.
The steps below are probably only for react native 0.61.0 and higher. Not tested with a lower version.
Please do not use my forked package mentioned below in your project, as I do not give support for that. I've forked this share extension project to fit my needs only. And to provide an example for others.
-
Follow the installation steps here. You can skip the parts about adding files to the Libraries folder and the Linked Libraries and Frameworks. Because you do not need that in React Native 0.61 and higher. Please follow the other steps exactly like mentioned. It's really important to double check this before following the steps below.
-
Fork this project. Because that (this) share extension project is clearly abandoned. You're now going to manage this on your own as this allows you to add a
podspec
file. -
Create a
ReactNativeShareExtension.podspec
file in the root of your newly forked share extension package. Example from my fork of this project. -
Change the
s.source
url in the.podspec
file to match your forked repo url, ending with.git
. Something like this:
s.source = { :git => "https://github.com/YOUR_USERNAME/react-native-share-extension.git", :tag => "master" }
-
Push those changes to your forked repository
master
branch. If you do any other changes in your share extension repo you need to reinstall the share extension throughnpm install
,pod deingegrate
andpod install
, so it fetches the changes from the repo. Just something you need to keep in mind. -
Edit your
./package.json
in your own react native project and use your forked project as the dependency forreact-native-share-extension
. ChangeYOUR_USERNAME
to your Github username:
"react-native-share-extension": "git+https://github.com/YOUR_USERNAME/react-native-share-extension#master",
-
Run
npm install
in the root of your React Native project, this will install the share extension files from your own github repo, including the new.podspec
file. -
Go to the
./ios
directory and add this to yourPodfile
, just below the React pods:
pod 'ReactNativeShareExtension', :podspec => '../node_modules/react-native-share-extension/ReactNativeShareExtension.podspec'
- In the same Podfile, add your Share Extension as a target and some build settings config. Here's an example how my Podfile looks with react native
0.61.x
:
# My app only supports iOS 11 and up, this might also be relevant to know
platform :ios, '11.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
# "YourApp" needs to be the name of your app as already defined in the Podfile
target 'YourApp' do
# React pods taken from: https://github.com/facebook/react-native/blob/v0.61.2/template/ios/Podfile
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/'
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
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'
# Your share extension pod
pod 'ReactNativeShareExtension', :podspec => '../node_modules/react-native-share-extension/ReactNativeShareExtension.podspec'
# Add this:
use_native_modules!
# Add this below your pods. Where "YourAppShareExtension" is your Share Extension's target name
target 'YourAppShareExtension' do
use_native_modules!
inherit! :complete
end
end
# Add this, taken from: https://github.com/facebook/react-native/issues/25792#issuecomment-517295859
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
end
end
end
-
Run
pod install
in the./ios
directory -
Open Xcode using your projects
.xcworkspace
file, NOT the.xcodeproj
file at./ios/YourApp.xcworkspace
-
When opened in Xcode, go to:
File
>Workspace Settings
> Make sureBuild System
isLegacy Build System
. -
Make sure
React.xcodeproject
andReactNativeShareExtension.xcodeproj
are not in yourLibraries
directory. If they are, selectDelete
and remove their reference (not trash it). -
Remove all other references which you don't need any more from
Frameworks and Libraries
underGeneral
on your main and share extension target. Examples how my personalFrameworks and Libraries
look like:
Example my main target:
libPods-App.a
ShareExtension.appex
Example my extension target:
libPods-App-ShareExtension.a
-
Remove
React (React)
fromBuild Phases
>Depedencies
on your main target and share extension target, if present. -
Go to
Product
>Scheme
>Manage schemes
> Select your share extension schema and thenEdit
. Go toBuild
on the top-left. -
Remove the "old"
React
from your extension's schema, if present. -
Make sure
Parallize Build
is unchecked on your main schema and share extension schema. -
On the Share Extension schema screen add
React
fromPods/React
as a new target using the small+
-
Close that schemes screen
-
Make sure the
Header Search Paths
inBuild Settings
in your main app target Γ‘nd share extension target has$(inherited)
on top withnon-recursive
selected. Delete any other reference except the ones your app really needs. Also make sure thereact-native-share-extension
is not present there anymore. If it is, remove it. You'll probably only need$(inherited) non-recursive
in there. -
In xcode press and hold
option
+shift
+CMD
+k
to clean the build folder -
Build. Should now succeed using react-native 0.61.0
I NEED HELP!!!
Please write detailed instructions on how to run this all on a clean project. I try to install according to the instructions and still get an error:
/node_modules/react-native-share-extension/ios/ReactNativeShareExtension.h:2:9: 'React/RCTBridgeModule.h' file not found
Xcode 10.3 "react": "16.9.0", "react-native": "0.61.1",
You'll first have to follow the readme like here: https://github.com/alinz/react-native-share-extension#setup except for the part about where you need to add the static libraries. That's not relevant anymore for react-native 0.61.*, so you can skip that.
Then come back here and follow the steps mentioned above.
I'm getting the same error on a fresh react-native
v0.61.2 project as well even after following these directions along with https://github.com/alinz/react-native-share-extension#setup
'React/RCTBridgeModule.h' file not found
I have the same issue ('React/RCTBridgeModule.h' file not found
), the solution provided above doesn't work with 0.61.x. @jvandenaardweg Could you provide a sample project with your solution working ? Maybe you forgot to mention some step, which is causing the issue.
I managed to fix the error by adding $(inherited)
to the extension target Header Search Paths
and Library Search Paths
.
then adding :
target 'PPShare' do
inherit! :search_paths
end
just before use_native_modules!
in the Podfile and doing pod install
I indeed got some more feedback about steps needed to get it working. However, the header search path thing is something from the original readme.
Iβll try to update the steps mentioned above today to add the missing steps
I have the same issue ('React/RCTBridgeModule.h' file not found), the solution provided above doesn't work with 0.61.x.
Well, it should work, but I probably forgot something
I've update the steps above about changes needed in the Podfile and header search paths. Also added you need to open the .xcworkspace
file and use the Legacy Build System
. I guess it should be complete now as I walked through this with someone else successfully. Only tested on react native 0.61.x
.
It's important your project builds correctly without any share extension active first, to rule out any problem with your own react native setup.
Hope this might help others.
Easier solution for new users would be a seperate fork with the current state of this project, but with an updated readme and a podspec
file. But i don't have time to maintain a open source project right now.
It seems this share extension project is abandoned unfortunately. However, if the above steps still don't help, I could help developers set this up using a screen sharing session and a small fee. Just contact me on Linkedin. Already made a developer very happy with a working setup.
I got it working on both iOS and Android for RN 0.61.2 following these latest instructions. Thanks!
I am using 0.60.4 and I having the compiling error : React/RCTBridgeModule.h file not found
I am around two days trying to figure out what I am doing wrong.
- on step 18 there is not Pods/React right there
- I have tried both configuration: this one(#182 (comment)) and yours. And with both I could not fix the problem.
- On step 13. there is not libReactNativeConfig.a file
Thank you very much in advanced.
Itβs important to use React Native 0.61.0 or higher using the steps above. As that resolves 1. If you cannot upgrade to that version this issue cannot help you, as it contains 0.61.x specifics
Hey i have done this setup, my share extension is showing up, but when i click on it, it opens a transparent screen, doesn't load anything from my React Code
Running in to same issue as @Epiczzor. My config is:
ReactNative 0.60.5, version of IOS: 13.1.2.
It is showing my App in a list off Apps. When you click on it, transparent modal show-up, but nothing else happening. It should pick up 'MyShareEx' component and show it, but it's not:
Please create an other issue for 0.60.x and lower. So we can keep this for 0.61.x, as there are differences between those versions on how to get this to work
After reviewing my code I made decision to start config from the scratch. @Epiczzor I made it work by doing exactly the same as @jvandenaardweg describe in a beginning of this tread. Transparent Modal show-up and in 2-3 seconds ReactNative View for share extension appear as well. So this manual works for ReactNative 0.60.5 and IOS: 13.1.2.
On 0.61.0 and following @jvandenaardweg's instructions in the second post gets me to a point with the following error output on build of my share ext (note that MemexShare
is the name of my share ext's main class):
Undefined symbols for architecture x86_64:
"_OBJC_METACLASS_$_ReactNativeShareExtension", referenced from:
_OBJC_METACLASS_$_MemexShare in MemexShare.o
"_OBJC_CLASS_$_ReactNativeShareExtension", referenced from:
_OBJC_CLASS_$_MemexShare in MemexShare.o
"_OBJC_CLASS_$_RCTRootView", referenced from:
objc-class-ref in MemexShare.o
"_OBJC_CLASS_$_RCTBundleURLProvider", referenced from:
objc-class-ref in MemexShare.o
"_RCTRegisterModule", referenced from:
+[MemexShare load] in MemexShare.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Has anyone experienced this? If not, does anyone know what could cause such an error?
I've been stuck at this stage, messing around with different settings that I don't fully understand for hours now. I feel like I've read through and followed the main repo instructions + @jvandenaardweg's enough times now that I'm fairly confident I'm not missing any steps, although I always get back to this point.
I'm using 0.61 and followed all the steps and my view is not loading up, its transparent no matter how long i wait
On 0.61.0 and following @jvandenaardweg's instructions in the second post gets me to a point with the following error output on build of my share ext (note that
MemexShare
is the name of my share ext's main class):Undefined symbols for architecture x86_64: "_OBJC_METACLASS_$_ReactNativeShareExtension", referenced from: _OBJC_METACLASS_$_MemexShare in MemexShare.o "_OBJC_CLASS_$_ReactNativeShareExtension", referenced from: _OBJC_CLASS_$_MemexShare in MemexShare.o "_OBJC_CLASS_$_RCTRootView", referenced from: objc-class-ref in MemexShare.o "_OBJC_CLASS_$_RCTBundleURLProvider", referenced from: objc-class-ref in MemexShare.o "_RCTRegisterModule", referenced from: +[MemexShare load] in MemexShare.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Has anyone experienced this? If not, does anyone know what could cause such an error?
I've been stuck at this stage, messing around with different settings that I don't fully understand for hours now. I feel like I've read through and followed the main repo instructions + @jvandenaardweg's enough times now that I'm fairly confident I'm not missing any steps, although I always get back to this point.
Try add $(inherited) to top of Build Settings -> Other Linker Flags
do you guys have a .h file for the share extension ?
Try add $(inherited) to top of Build Settings -> Other Linker Flags
Thanks a lot @saveliy-kremen, that solved that error and got me to the next one. Eventually, after working through a few more, I ended up getting a successful build :)
The other errors involved me adding other dependent packages I am using to the Podfile
, then running pod install
again, and removing the associated libs from ${TARGET} > General > Frameworks and Libraries
and the Libraries
directory in the XCode project navigator.
These are probably fairly obvious things to do, though I'm still fairly new to React Native and generally have no idea what's going on when I have to do things via XCode. Though I slowly seem to be getting a better idea of some common interactions, like dealing with deps and build settings. Hopefully this is useful for others.
Swift errors should not be related to this share extension package, as it does not use Swift. I think it's better to find out which package uses Swift and see in the docs of that package if the setup is done correctly.
It seems like you use Lotti, maybe one of these issues will help you if this is the package you use: https://github.com/react-native-community/lottie-react-native/issues?utf8=%E2%9C%93&q=linker
To give you some hope: I'm also using packages that need Swift, so it's possible to get it working. But setup differs per package.
The suggestion above to create a bridging header is something i've also done, but that was required for the package i've used.
@lichwa , @jvandenaardweg Thanks! But my project already had dummy swift file and bridging header file.
I added use_frameworks! to Podfile and lottie errors were gone. Then, I got some clang errors but after removing all *.a files from "Link Binary With Libraries" for main target, works fine now.
Hey guys, im following the steps like you said, but i start getting discrepancies from Step 13 onwards, libReactNativeConfig is not present in my project, it doesnt show up in the list.
Also doesn't show up in Manage Schemes like mentioned in step 18
everything else is on point
My Build is successful and I get a transparent page, i suspect the code is not opening my JS page at all. Not sure how to check logs
please help me out on this issues #188
Hey guys, im following the steps like you said, but i start getting discrepancies from Step 13 onwards, libReactNativeConfig is not present in my project, it doesnt show up in the list.
If you are familiar with how react native works, then you know that libReactNativeConfig
serves just as an example to show there could be other options there if your project requires it π
So it's not required if your project doesn't have it.
I'll remove it from the steps to prevent confusion.
Ohh! Thanks a lot,
Also in Step 18 React didn't show up in Pods/React when adding it to the scehme
Just saw the logs:
2019-11-14 20:47:43.132 [info][tid:main][RCTRootView.m:293] Running application ShareSong ({
initialProps = {
};
rootTag = 1;
})
2019-11-14 20:47:43.133412+0530 ShareSong[44571:4363211] -[RNFirebase init] [Line 18] Setting up RNFirebase instance
2019-11-14 20:47:43.133613+0530 ShareSong[44571:4363211] -[RNFirebaseMessaging init] [Line 33] Setting up RNFirebaseMessaging instance
2019-11-14 20:47:43.133693+0530 ShareSong[44571:4363211] -[RNFirebaseNotifications init] [Line 46] Setting up RNFirebaseNotifications instance
2019-11-14 20:47:43.134277+0530 ShareSong[44571:4363470] 6.8.1 - [Firebase/Core][I-COR000005] No app has been configured yet.
2019-11-14 20:47:43.134698+0530 ShareSong[44571:4363470] 6.8.1 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your application initialization. Read more: https://goo.gl/ctyzm8.
2019-11-14 20:47:43.134856+0530 ShareSong[44571:4363470] 6.8.1 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your application initialization. Read more: https://goo.gl/ctyzm8.
2019-11-14 20:47:43.144164+0530 ShareSong[44571:4363462] [] nw_socket_handle_socket_event [C3.1:1] Socket SO_ERROR [61: Connection refused]
2019-11-14 20:47:43.154125+0530 ShareSong[44571:4363462] [] nw_socket_handle_socket_event [C3.2:1] Socket SO_ERROR [61: Connection refused]
2019-11-14 20:47:43.154421+0530 ShareSong[44571:4363483] [] nw_connection_get_connected_socket [C3] Client called nw_connection_get_connected_socket on unconnected nw_connection
2019-11-14 20:47:43.154459+0530 ShareSong[44571:4363483] TCP Conn 0x2813cd980 Failed : error 0:61 [61]
2019-11-14 20:47:48.873 [warn][tid:com.facebook.react.JavaScript] Require cycle: src/Components/RealmHandler.js -> src/Components/GroupDatabaseManager.js -> src/Components/RealmHandler.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2019-11-14 20:47:48.882 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/utils/apps.js -> node_modules/react-native-firebase/dist/modules/core/app.js -> node_modules/react-native-firebase/dist/utils/apps.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2019-11-14 20:47:48.883 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/admob/index.js -> node_modules/react-native-firebase/dist/modules/admob/Interstitial.js -> node_modules/react-native-firebase/dist/modules/admob/index.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2019-11-14 20:47:48.883 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/admob/index.js -> node_modules/react-native-firebase/dist/modules/admob/RewardedVideo.js -> node_modules/react-native-firebase/dist/modules/admob/index.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2019-11-14 20:47:48.888 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/database/Reference.js -> node_modules/react-native-firebase/dist/utils/SyncTree.js -> node_modules/react-native-firebase/dist/modules/database/Reference.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2019-11-14 20:47:48.889 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/core/firebase.js -> node_modules/react-native-firebase/dist/utils/apps.js -> node_modules/react-native-firebase/dist/modules/core/app.js -> node_modules/react-native-firebase/dist/modules/database/index.js -> node_modules/react-native-firebase/dist/modules/core/firebase.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2019-11-14 20:47:48.890 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/firestore/DocumentSnapshot.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentSnapshot.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2019-11-14 20:47:48.890 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/firestore/CollectionReference.js -> node_modules/react-native-firebase/dist/modules/firestore/Query.js -> node_modules/react-native-firebase/dist/modules/firestore/QuerySnapshot.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentChange.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentSnapshot.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js -> node_modules/react-native-firebase/dist/modules/firestore/CollectionReference.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2019-11-14 20:47:48.890 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js -> node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2019-11-14 20:47:48.891 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js -> node_modules/react-native-firebase/dist/modules/firestore/FieldValue.js -> node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2019-11-14 20:47:48.892 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/core/firebase.js -> node_modules/react-native-firebase/dist/utils/apps.js -> node_modules/react-native-firebase/dist/modules/core/app.js -> node_modules/react-native-firebase/dist/modules/functions/index.js -> node_modules/react-native-firebase/dist/modules/core/firebase.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2019-11-14 20:47:48.901 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/storage/index.js -> node_modules/react-native-firebase/dist/modules/storage/reference.js -> node_modules/react-native-firebase/dist/modules/storage/task.js -> node_modules/react-native-firebase/dist/modules/storage/index.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2019-11-14 20:47:48.989 [info][tid:com.facebook.react.JavaScript] Running "ShareSong" with {"rootTag":1,"initialProps":{}}
2019-11-14 20:47:49.019 [error][tid:main][RCTAlertManager.m:95] Tried to display alert view but there is no application window. args: {
buttons = (
);
title = "You can share here";
type = default;
}
@Epiczzor
It should look like this
Yeah, its not there in the list,
and turns out i didnt need it, i managed to solve my issue, after checking around in the logs i found out that firebase was the cause of this issue, it was crashing the extension because it wasn't initialized. after a few tries i have it working now.
Thanks for all the help guys !
Editted step 20:
Make sure the Header Search Paths in Build Settings in your main app target Γ‘nd share extension target has $(inherited) on top with non-recursive selected. Delete any other reference except the ones your app really needs.
To
Make sure the Header Search Paths
in Build Settings
in your main app target Γ‘nd share extension target has $(inherited)
on top with non-recursive
selected. Delete any other reference except the ones your app really needs. Also make sure the react-native-share-extension
is not present there anymore. If it is, remove it. You'll probably only need $(inherited) non-recursive
in there.
For other struggling with getting this to work: make sure you also follow the steps in the original readme from this package. As I notice when I help others with this, mostly some of those steps from the original readme are missing.
Successfully built my project using the steps but after share app press the react-native view not rendering and screen freezes. Maybe someone has encountered a similar problem?
I'm using 0.61 and followed all the steps and my view is not loading up, its transparent no matter how long i wait
@Epiczzor
Successfully built my project using the steps but after share app press the react-native view not rendering and screen freezes. Maybe someone has encountered a similar problem?
@dabakovich
I recently helped another developer with the setup of this which had the same problem. I notice the following was missing in his setup:
Targets -> "ShareExtension" -> Build Phases -> Run Script:
export NODE_BINARY=node
../node_modules/react-native/scripts/react-native-xcode.sh
Add it by: Select your "ShareExtension" target -> In the top menu: Editor -> Add Build Phase -> Add Run Script Build Phase.
Which is actually part of the original readme.
Might be unrelated, but I also noticed I had this in my Info.plist
in the share extension folder, which he was missing:
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
I got it working on both iOS and Android for RN 0.61.2 following these latest instructions. Thanks!
Please help us to implement this into my project.. I am using react native 0.62.2
$(inherited)
$(inherited) added in other link flags in my app share extension. but its not resolved.. Please help us
i ve used this package with all new features with react native greater than 0.60 support react-native-receive-sharing-intent
Thanks @jvandenaardweg
"react-native": "0.60.5"
worked!
We needed one additional step to get this working with rn 0.60.6 which was to remove -ObjC
and -lc++
from Build Settings > Linking > Other Linker Flags and replace with $(inherited)
. Leaving the existing flags was resulting in duplicate symbol errors.
Ultimately the steps we took to get this working with 0.60.6 were:
-
Update podfile as mentioned in @jvandenaardweg's earlier comment
-
pod update
-
Notice that a
libPods-YourApp-YourShareExtension.a
link was created in General > Frameworks and Libraries. We were able to get the ShareExtension to build at this phase but were running into the error mentioned in #48. This was prior to removing the manually linked libraries that were present before the upgrade. Remove all links other thanJavaScriptCore.framework
and the libPods link. -
Next we were seeing duplicate symbol errors causing the build to fail which was resolved by updating the Other Linker Flags as mentioned earlier.
Thanks for all your work on this @jvandenaardweg
Got it working on 0.63.2 by following above comment, but without the need to update the Podfile
with this line:
pod 'ReactNativeShareExtension', :podspec => '../node_modules/react-native-share-extension/ReactNativeShareExtension.podspec'
Thanks @jvandenaardweg