React-native custom native module couldn't search header search path - ios

I am building a wrapper SDK in react-native. However, I am new to react-native and facing following issues:
I have created a library using react-native-create-library npm package. While compiling iOS module it gives error that React-native bridge is not found.
I ignored the issue and integrated my code. When I link the SDK in a client app (created using react-native init), the SDK doesnt give the error for react-native bridge.
The existing iOS SDK is integrated via cocoapods in client app and I am trying to link it in the wrapper SDK via header search path. But whatever I try, I keep getting an error that the "module not found".
I am using Xcode 10 and Swift 5.
When I run pod install, the existing iOS SDK copies the files in Pods folder. I thought it should copy the framework file so that header search path could look up the headers in it. I have provided ${SRC_ROOT}/../../../ios/Pods as recursive in wrapper SDK's header search path. But it didn't work.
Can somebody please help me with the issues? I have googled for sample codes and suggestions but none of them worked.

Related

Exposing flutter module as IOS framework results in "Failed to find assets path for "Frameworks/App.framework/flutter_assets"

I am receiving Failed to find assets path for "Frameworks/App.framework/flutter_assets when trying to expose a Flutter project via a framework to another IOS project (Add to App via a Framework).
I created a Flutter project that i now want to expose as a native Framework for IOS. We want to share our project with other companies so that they can integrate it in their IOS application.
I followed the documentation described on https://flutter.dev/docs/development/add-to-app/ios/project-setup and i used option C. This will create an XCFramework of our Flutter module and integrate it in our native IOS Framework which will have an API to work with the flutter project. In that way our IOS Framework can be seen as an Umbrella kind of Framework but also with an exposed API.
So what i created is:
A Flutter module
An IOS Framework
An IOS Project
I build the flutter module using ./flutterw build ios-framework --cocoapods --xcframework --no-universal --output=../WhiteLabelIOSFrameWork/Flutter --verbose into the IOS Framework. I added the libraries to the Framework and i created a codespec file for the Framework with only Flutter as a dependency. Afterwards i added a Podfile to the project and added the Framework as a dependency.
All of this is working (i only needed to upgrade to Flutter 1.24.X to have this fix available https://github.com/flutter/flutter/pull/69736). But when i start my Flutter engine it's unable to find the flutter_assets (Failed to find assets path for "Frameworks/App.framework/flutter_assets).
I tried building the ios-framework directly into our IOS project and skip the in between Framework and then it seems to work. So i think it cannot find the flutter_assets since the App.framework is not in the IOS project itself, but in a Framework in between.
Is there a way to move the flutter_assets path or so? Or any other idea on how to solve this?
Kind regards,
Daan
This issue cause when you create Flutter Engine without FlutterDartProject.
Just add FlutterEngine(name: "your name", project: FlutterDartProject(precompiledDartBundle: Bundle.init(for: Self.self)))

What is the best practice to include third party ios sdk framework in react-native module library?

I am trying to include ios sdk framework in my react-native module library. I turned always embed swift standard library to Yes in build setting. Everything compiles fine.
Then I include the node module in an app using npm i react-native-my-framework, open sampleapp.xcworkspace and build in XCode, I get an error MyFramework/MyFramework-Swift.h not found. I tried following permutation combinations:
Put MyFramework to Frameworks, Library and Embedded Contents. and tried some other combination of build settings.
Set the framework search path in the library project - $(PROJECT_DIR)/../node_modules/react-native-my-framework/ios/
I manually included libMyFramework.a to Libraries group.
But I am still facing the same issue. What am I missing here?
Also, MyFramework is not on Cocoa pods
Update:
Now MyFramework is available on Cocoapods

Error message - RNFirebase core module was not found natively on iOS

React Native Firebase won’t install on iOS React Native project. It works fine on Android.
I followed this instruction.
https://rnfirebase.io/docs/v5.x.x/installation/initial-setup
I set up Firebase, added the downloaded plist file via XCode, installed and set up Cocoapod.
The moment I add the following line to my App.js, the simulator returns an error message.
import firebase from 'react-native-firebase';
The error message: “RNFirebase core module was not found natively on iOS”
I’ve tried a few things I picked up from this forum:
https://github.com/invertase/react-native-firebase/issues/614
I commented out following lines from Podfile
use_frameworks!
And then pod install, pod update
on Xcode, checked the Build Phases/ Link Binary with Libraries section. I checked libRNFirebase.a was already there.
I've been trying this for a few months now on and off. And I haven't found a way to make React Native Firebase install on iOS project. Any pointer would be much appreciated.
I'm currently maintaining the react-native-firebase v5 branch (current stable) and we do have a problem with the header search paths right now for some reason.
I don't have a definitive fix, but I constructed a demo that goes from react-native init, then installs react-native-firebase, and does all the things necessary such that the project builds and runs on iOS and even archives in release mode.
You may see it here: https://github.com/mikehardy/rnfbdemo
The only thing that is important at the moment is that you need to put one non-documented thing in your Podfile after following all the install instructions, as the last line before the final end
system("mkdir -p Pods/Headers/Public/FirebaseCore && cp Pods/FirebaseCore/Firebase/Core/Public/* Pods/Headers/Public/FirebaseCore/")

Having issues with an iOS react native native module using a CocoaPod

I'm creating a native module wrapper for the Google Nearby Messsages API.
I've installed the api using these instructions https://developers.google.com/nearby/messages/ios/get-started
I then published the project to npm and created an example project to consume react-native-nearby.
I've been stuck with this issue.
I ran yarn to install react-native-nearby and react-native link react-native-nearby. Yet it can't find GNSMessages.h which should have been installed using cocoapods? Would be happy to get a lead as to why it can't find that file.

Adding Firebase via importing SDK (not CocoaPods) causes file not found exception

I am attempting to add Firebase to my iOS project via importing the SDK instead of using CocoaPods (I'm not a fan).
I have followed the documentation but I am getting file not found error.
I have cleaned, deleted, restarted, re-imported, re-did the instructions SEVERAL times and I keep getting this error.
Has anyone succesfully imported the Firebase SDK into an iOS project?
Added to the projects directory:
The frameworks auto-added themselves to the Linked Frameworks
Added the -ObjC to Other linker flags
But still the file not found error:
Any help?
Inside the frameworks:
Pastebin of the Build file: PASTBIN
Try adding the Firebase SDK to the root directory and later move them to the frameworks folder.

Resources