Modify CocoaPods Podfile for MLKit
I would like to implement react-native-camera for managed workflow which requires MLKit for text recognition.
How do I add the following snippet to the CocoaPods Podfile so I can enable text recognition?
pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs: [
'TextDetector',
'FaceDetectorMLKit',
'BarcodeDetectorMLKit'
]
Confusing documentation
Yes, it's possible to run native code in managed workflow
EAS for building dev build
Install the dev build build on device
Start dev client and scan QR code on device
I was unable to modify the podfile after build so forked the project and made the necessary changes myself, this way I didn't need to modify the podfile.
Related
I have a problem trying to run an application made in react-native which uses Flipper in apple silicon, I get the following error:
I tried some things like running Xcode in rosetta mode but it didn't work, I also tried some possible solutions mentioned in this issue, but none of the options worked.
for now, the only thing that has worked is to adjust the react-native.config.js file to prevent auto-linking for Flipper, like so:
module.exports = {
dependencies: {
'react-native-flipper': {
platforms: {
ios: null,
},
},
},
//... other react native configs
};
This option disables Flipper and what I need is to make it work, not to disable it.
Bump the FLIPPER_VERSION variable in android/gradle.properties. as
# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.158.0
Then run cd android && ./gradlew clean && cd ..
It will integrate flipper on your project. By using this you need to install flipper to debug an app on your system and then install Sdk on the flipper app. then you can debug your app by using the flipper.
For further explanation, you can visit Here.
I hope this will help you.
Follow the below steps:
Clean everything, use everything based on the M1 build, I mean Xcode, packages, libraries and etc. everything must be based on the M1 build form
Initial an RN project, go to the ios folder, and run this command: arch -x86_64 pod install.
It wouldn't affect your project development source and an Intel base macOS system or other platforms would be able to continue on this source.
I am new to react native. I uses the Cli version. I installed some packages e.g. react-navigation. After the installation I open the ios folder and run pod install. It works fine, but with react-native-vector-icons I have to link it manually like this: react-native link react-native-vector-icons. And I don't have to run pod install. But what if I want to install additional packages after that like sqlite? For this package i have to run pod install. Do I have to reinstall the vector icons after every other package installation? I am new to react-native and I don't now much about "pod install", "linking" and so on. So please give me a bit more details on how to work with adding new packages with this special task.
Many thanks
Jens
Since react-native 0.60 linking is no longer required since it is managed by react-native itself, remember that react-native is something like a "controller" in javascript that sends commands to native code in iOS and Android, pod install is the way you install the iOS native components required by your react-native libraries, something like npm install but for iOS.
react-native-vector-icons has its own iOS libraries, so it requires to run pod install(you should run a pod install everytime you add a new library, eventually you'll understand when you need to run it and when not). There's no harm in running several times pod install so don't worry about it. Also for react-native-vector-icons if I'm not mistaken, you also have to modify info.plist in order to have all the typographies available (This is the "hard" part about this library, it has additional typographies that should be embeded in your project)
Goal: In a react-native project, I'm using react-native-firebase v5.6 and because im using Firebase's authentication, I need to include "Firebase/Auth" in the pod file so react-native-firebase's bindings can use it.
Problem: Once pod "Firebase/Auth" is added and saved to podfile, and pod install is successfully run, the project build fails when compiling RNFirebaseAuth.m. I haven't added any auth related code, just simply installed the pod and clean&ran build. Sidenote, other react-native-firebase setup/integration has been successful to this point.
Failing Error:
/path/to/project/node_modules/react-native-firebase/ios/RNFirebase/auth/RNFirebaseAuth.m:1184:36: error: no known class method for selector 'credentialWithProviderID:IDToken:rawNonce:'
credential = [FIROAuthProvider credentialWithProviderID:#"apple.com" IDToken:authToken rawNonce:authTokenSecret];
Have I just missed an installation step or what? How do I fix build?
According to mikehardy on GitHub, react-native-firebase v5.6 has a minor breaking change that enforces the use of firebase pods with at least version 6.13.
I ran pod update and that was all that was needed to fix the build
Is there any way to create the IOS project with pods using react-native init command?
Currently there is different installation instruction for react native libraries.
Example: Some of them install using react-native link command while other requires to setup using cocoapods. Missing both will leads to lots of compilation errors.
Could anyone suggest what is best way to create project using react-native.
Thanks
On the official react native documentation, there are 2 ways to start up your project, which is using 'CRNA' or 'Build With Native Code'.
For CRNA, it is the fastest and easiest way to start up your project.
It really easy to run your React Native app on a physical device without setting up a development environment. If you want to run your app on the iOS Simulator or an Android Virtual Device, please refer to the instructions for building projects with native code to learn how to install Xcode and set up your Android development environment.
The react native link is used if you want to link your library through the terminal. But in some cases, there are several problem occurred related to library compatibility. I rather suggest use pods or manually link your library through XCode.
Pods is a dependency manager for native code that we use on our native code project. It will automatically generate and link the library.
If you want to have pods on your ios project. After you install cocoapods, you could follow these steps :
1. Open terminal and direct to your project (cd YOUR_PROJECT/ios
2. pod init
3. And then Podfile will be generated within the ios project.
And from now on, you should use YOUR_PROJECT.xcworkspace if you want to manage the project. Thats because Pods should be placed and included same with your project but '.xcodeproj' does not include your Pods.
In the installation instructions for iOS, it says to run
react-native link
After completion I see:
However, compiling immediately fails with the error React/RCTViewManager.h not found:
When looking at the integration instructions on Facebook's website, it has us using a Podfile. When you use a Podfile, your project looks like this:
Comparing this to the react native sample project, I can see that in fact, it does not appear to use a Podfile to integrate react native at all; instead all React components are included as libraries:
Thus, I suspect that the integration instructions for react-native-video are not compatible with the integration instructions found here.
Can anyone suggest how to integrate react-native-video when using Podfiles to integrate react-native?
What version of react native are you using? This looks like it's due to the breaking change for RN version >0.40.
The short fix for this issue is if you see #import React/$(filename) in the native code, replace it with #import "$(filename)", but if you can update to RN >0.40 that would be preferable.
To answer your question about pods, you should be able to add something like pod 'react-native-video', :path => '../node_modules/react-native-video' to your podfile and run pod install (if the relative path from your Podfile to the library root is incorrect replace it with the correct one). Looking at the github page for react-native-video, it does have a podspec so it probably supports cocoapods installation