I'm currently trying to set up my first RN app on a Mac. I'm new to iPhone development as well as Macs in general. So of course I'm in the process of learning and debugging. Obviously, different people on the forums recommend a variety of different approaches to address a variety of different issues. And there is some overlap between native iOS development and RN app configuration on a Mac.
I have some questions in regards to the Podfile. Sometimes people on forums recommend making updates to the Podfile for a variety of reasons. But I think that I've read a comment by at least one developer that Podfile should not be manually updated. What is your opinion on this from a RN app config perspective?
As part of one proposed solution, one developer recommended deleting the Podfile.lock file. It seems to me that the .lock is placed on Podfile for a reason. To maintain some type of integrity, etc. So would you ever manually delete the Podfile.lock file during the course of troubleshooting? Or would you only do this indirectly through the execution of some other type of more structured process?
With RN versions 0.60+ you almost do not need to touch the pod file.
Unless:
1) You have some old react native library dependency that do not support auto-linking or
2) Need to change the targeted platform from platform :ios, '9.0' to something newer or
3) Need some external SDK dependency and have to add some line like pod 'Google-Mobile-Ads-SDK'
Just go to ios folder and run
pod install or
pod install --repo-update
All the React libraries and the ones you added with yarn or npm (that support auto linking) will be installed.
For older libraries you should get some warning that they cannot be linked and you should just use react-native link <libraryName> or just add a line in pod file and run pod install again.
More details:
This is how a RN 0.61.4 pod file for a basic app (called RnDiffApp) looks like:
platform :ios, '9.0'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
target 'RnDiffApp' do
# Pods for RnDiffApp
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'
target 'RnDiffAppTests' do
inherit! :search_paths
# Pods for testing
end
use_native_modules!
end
target 'RnDiffApp-tvOS' do
# Pods for RnDiffApp-tvOS
target 'RnDiffApp-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
The line use_native_modules! will just tell CocoaPods to install (when you run pod install) all native deps from node_modules that support auto linking.
For those react-native dependencies from node_modules when you run pod install you should see some note like this:
Detected React Native module pods for RNCAsyncStorage, RNDeviceInfo ...
You should not need to touch the Podfile.lock.
Related
enter image description here
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'Firebase/Analytics'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Storage'
I am trying to install firebase/Messaging, with FirebaseAnalytics but it gives error shown in below. please suggest the solution.
!] Unable to find a specification for FirebaseAnalyticsInterop (~> 1.5) depended upon by FirebaseMessaging
You have either:
* out-of-date source repos which you can update with pod repo update or with pod install --repo-update.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
I have been able to install the dependencies with below pod file without any issues.
use_frameworks!
platform :ios, '9.0'
install! 'cocoapods'
target 'PodTest' do
use_frameworks!
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'Firebase/Analytics'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Storage'
end
Can anyone explain why the pod install removing the React. Also it shows the React missing in product-->Edit scheme.
I need any good solution
RCTBrigeModule.h file not found error?
I dont have any idea how to fix this.
Before unlinking the package and not run pod install
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
pod 'Fabric'
pod 'Crashlytics'
target 'App' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for App
target 'App-tvOSTests' do
inherit! :search_paths
# Pods for testing
pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'
pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
pod 'RNImageCropPicker', :path => '../node_modules/react-native-image-crop-picker'
pod 'react-native-camera', :path => '../node_modules/react-native-camera'
pod 'RNImageRotate', :path => '../node_modules/react-native-image-rotate'
pod 'RNShare', :path => '../node_modules/react-native-share'
pod 'RNViewShot', :path => '../node_modules/react-native-view-shot'
pod 'RNFS', :path => '../node_modules/react-native-fs'
pod 'BugsnagReactNative', :path => '../node_modules/bugsnag-react-native'
pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
pod 'react-native-webview', :path => '../node_modules/react-native-webview'
end
target 'AppTests' do
inherit! :search_paths
# Pods for testing
end
end
After linking and run pod install
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
pod 'Fabric'
pod 'Crashlytics'
target 'App' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for App
target 'App-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
target 'AppTests' do
inherit! :search_paths
# Pods for testing
end
end
If you trying to to upgrade to v0.60+, you have to do this manually with this tool.
(https://react-native-community.github.io/upgrade-helper/). There is many breaking changes including pod support and androidX support.
Update all libraries to latest version, remove all manual linked libraries before RN upgrade from Xcode, to avoid Xcode crashes.
This article may help https://reactnative.thenativebits.com/courses/upgrading-react-native/upgrade-to-react-native-0.60/
I have a clarification. I am trying to upgrade my react-native version. But still, it shows the runtime errors. Can anyone able to build the react-native (0.61.5) without any issues.
React/RCTBridgeModule.h' file not found is faced by many of us. No solution yet. So I moving to 0.60.0. Anyone have any good solution.
In file included from /Applications/App/ios/helloworld/AppDelegate.m:11:
../node_modules/bugsnag-react-native/cocoa/BugsnagReactNative.h:3:9: fatal error: 'React/RCTBridgeModule.h' file not found
Note: pod install from ios folder, cleaning the pod and Xcode and also I tried with many solutions. Nothing worked for me.
My Podfile Before
# Uncomment the next line to define a global platform for your project
#platform :ios, '9.0'
#require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
pod 'Fabric'
pod 'Crashlytics'
target 'App' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
use_frameworks!
# Pods for App
target 'App-tvOSTests' do
inherit! :search_paths
# Pods for testing
pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'
#pod 'BugsnagReactNative', :path => '../node_modules/bugsnag-react-native'
#pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
pod 'RNImageCropPicker', :path => '../node_modules/react-native-image-crop-picker'
pod 'react-native-camera', :path => '../node_modules/react-native-camera'
pod 'RNImageRotate', :path => '../node_modules/react-native-image-rotate'
pod 'RNShare', :path => '../node_modules/react-native-share'
pod 'RNViewShot', :path => '../node_modules/react-native-view-shot'
pod 'RNFS', :path => '../node_modules/react-native-fs'
pod 'BugsnagReactNative', :path => '../node_modules/bugsnag-react-native'
end
target 'AppTests' do
inherit! :search_paths
# Pods for testing
end
end
My Podfile now
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
pod 'Fabric'
pod 'Crashlytics'
target 'App' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
use_frameworks!
# Pods for App
target 'App-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
target 'Apptests' do
inherit! :search_paths
# Pods for testing
end
end
I am trying to install XMPPFramework in my objective c Project using Podfile.I had write this in my Podfile:
platform :ios, ‘8.0’
use_frameworks!
target ‘XMPP’ do
pod 'XMPPFramework', :git =>"https://github.com/robbiehanson/XMPPFramework.git", :branch => 'master'
end
But I am getting this Error while pod install this error is show in console.This is the image of console::
Can some one please Help me.Thanks.
Add this in your pod file,
pod 'XMPPFramework'
Remove ,
pod 'XMPPFramework', :git
=>"https://github.com/robbiehanson/XMPPFramework.git", :branch => 'master'
Run,
pod install
Try this. Hope it will help you.
I have upgraded to Xcode 7 and my project to Swift2. My project is a hybrid of ObjC and Swift code. I also upgraded to cocoa pods 0.38.2. After the upgrade, the project has failed to compile. Specifically, compilation is failing with the following error:
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
I have traced this problem to the following message:
MergeSwiftModule normal x86_64 /Users/murdockcrc/repos/HdV%20-%20iOS/Build/Intermediates/Pods.build/Debug-iphonesimulator/SwiftyJSON.build/Objects-normal/x86_64/SwiftyJSON.swiftmodule
which fails with the following error:
<unknown>:0: error: error opening '/Users/murdockcrc/repos/HdV%20-%20iOS/Build/Intermediates/Pods.build/Debug-iphonesimulator/SwiftyJSON.build/Objects-normal/x86_64/SwiftyJSON-Swift.h' for output: No such file or directory
The problem is not related to SwiftyJSON only. Even if I remove this library, another of my Swift dependencies will fail with the same error.
I am not knowledgeable in the way cocoa pods works with frameworks and mixed objc-swift projects, but I supposed something is wrong with the umbrella headers and making the dependencies accessible to the swift compiler.
Here is my podfile
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target 'Helden der Volksmusik' do
pod 'DateTools', '1.5.0'
pod 'UALogger', '~> 0.3'
pod 'KZPropertyMapper', '2.5.0'
pod 'AFNetworking', '2.5.4'
pod "MTJSONUtils"
pod "TTTAttributedLabel", "1.13.3"
pod 'PureLayout', '2.0.6'
pod 'Alamofire', '~> 2.0'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git', :branch => 'xcode7'
pod 'SwiftDate', :git => 'https://github.com/malcommac/SwiftDate.git', :branch => 'swift-2.0'
pod 'SwiftSpinner', '0.8.0'
end
target 'Helden der VolksmusikTests' do
pod 'DateTools', '1.5.0'
pod 'UALogger', '~> 0.3'
pod 'KZPropertyMapper', '2.5.0'
pod 'AFNetworking', '2.5.4'
pod "MTJSONUtils"
pod "TTTAttributedLabel", "1.13.3"
pod 'PureLayout', '2.0.6'
pod 'Alamofire', '~> 2.0'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git', :branch => 'xcode7'
pod 'SwiftDate', :git => 'https://github.com/malcommac/SwiftDate.git', :branch => 'swift-2.0'
end