React Native iOS - I get addNetworkingHandler and NetInfo invariant violation errors after installing Firebase pods. How do I fix them? - xcode

After adding the podfile and installing Firebase I get this errors:
addNetworkingHandler on target BlobMdule with params()
requiring module "node_modules/react-native/libraries/network/netinfo.js"
which threw an exception:
invariant violation: Native module cannot be null.
I have tried everything but no luck. If you know about these errors please help! Screenshots:

try adding this to your podfile:
`pod "yoga", :path => "../node_modules/react-native/ReactCommon/yoga"
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'RCTText',
'RCTImage',
'RCTNetwork',
'RCTWebSocket'
]`

Related

Xcode 14 giving build error for flurry sdk

After updating to xcode 14 I'm getting build error
error build: Undefined symbol: _OBJC_CLASS_$_Flurry
error build: Undefined symbol: _OBJC_CLASS_$_FlurrySessionBuilder
I tried cleaning pods and reinstalling pods and also I tried adding libFlurry_11.2.1.a in build phases, it didn't work.
Platform target in pods is '12.1' and for flurry below command is used
pod 'Flurry-iOS-SDK/FlurrySDK', '~> 11.2.0'
I had to contact support but for me this worked:
pod 'Flurry-iOS-SDK/FlurrySDK', '~> 12.1.1'
and the "startSession" has changed to:
Flurry.startSession(apiKey: "***", sessionBuilder: FlurrySessionBuilder.init()
.build(crashReportingEnabled: true)
.build(logLevel: .all))
PS: Your "startSession" might be different. It depends on what you need.

"No such module 'Firebase'" // framework not found FirebaseUI

I previously had Firebase connected to my app with the below pods (excluding pod 'Firebase/DynamicLinks) and it was working just fine. I was using the line 'import Firebase' at the top of each view controller to import the relevant frameworks.
However, today I went to add pod 'Firebase/DynamicLinks' and when I went to run pod install, it got stuck 'analyzing dependencies'. I read through other forums on stackoverflow to fix this issue. I ended up removing cocoapods from my project and reinstalling them. I now have reinstalled the pods, but when I open Xcode I get the message 'No such module 'Firebase'. It essentially wants me to import specific Firebase modules [import FirebaseDatabase, import FirebaseAnalytics, etc.] instead of just [import Firebase]. After updating the import on all of my view controllers, there is 1 issue remaining -> 'Framework not found FirebaseUI'.
Questions
Is going from 'import Firebase' to 'import FirebaseDatabase, etc.' recommended or is this a step backwards?
How can I resolve 'Framework not found FirebaseUI'? I have the pod installed already.
Other info that may help
When running pod install, I get a warning notification: [!] [Xcodeproj] Generated duplicate UUIDs
When trying to build project, I also get: ld: warning: directory not found for option '-F/Users/[myNameHere]/Library/Developer/Xcode/DerivedData/[AppName]-dtipemvgjzrgzvephbatansalrwu/Build/Products/Debug-iphonesimulator/Firebase'
As well as: ld: warning: directory not found for option '-F/Users/[myNameHere]/Library/Developer/Xcode/DerivedData/[AppName]-dtipemvgjzrgzvephbatansalrwu/Build/Products/Debug-iphonesimulator/FirebaseUI'
My podfile
pod 'FirebaseUI'
pod 'FirebaseUI/Auth'
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Messaging'
pod 'Firebase/Analytics'
pod 'Firebase/Storage'
pod 'Firebase/Auth'
pod 'FirebaseUI/Google'
pod 'FirebaseUI/Facebook'
pod 'Firebase/DynamicLinks' (new)
After rereading the Firebase documentation, it turns out "You no longer need to add the iOS pod Firebase/Core. This SDK included the Firebase SDK for Google Analytics."
I ended up removing Core and the UI Cocoapods (using my own UI buttons instead) and the project now builds. I assume there may be an error installing the UI Framework with the FirebaseUI Cocoapod - idk.
Pods removed:
- pod 'Firebase/Core'
- pod 'FirebaseUI'
- pod 'FirebaseUI/Auth'
- pod 'FirebaseUI/Google'
- pod 'FirebaseUI/Facebook'

Getting 401 Unauthorized error when installing a pod

I'm setting up a new pod in my pod file and when I do pod install I have an error what should I doing ?
I tried this line to add the pod in my podfile :
pod 'MapboxVisionNativeAll', :podspec => 'https://api.mapbox.com/downloads/v1/vision/ios/mapbox-vision-native-all/0.3.0.podspec?access_token='
this the error
[!] Failed to fetch podspec for MapboxVisionNativeAll at https://api.mapbox.com/downloads/v1/vision/ios/mapbox-vision-native-all/0.3.0.podspec?access_token=<sk.eyJ1IjoiYnJhaGltY2hlYmJpIiwiYSI6ImNqdXlhMXl6aDBmeXo0M3BpYjV6MnFib3IifQ.VinI6ER1YN2nDxXRJzaFXw>.
Error: 401 Unauthorized
=> I guess, You are misplacing your .netrc.
=> The .netrc file should be in your home directory (~ on the command line, or use Go ‣ Home in Finder).
In terminal type: cd ~
touch .netrc
open .netrc
paste below to .netrc with SecretKey
machine api.mapbox.com
login mapbox
password <INSERT SecretKey>
Enjoy: pod install will work without error
Following is my working Podfile
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.2'
use_frameworks!
target 'PROJECT_NAME' do
pod 'MapboxVisionNativeAll', :podspec => 'https://api.mapbox.com/downloads/v1/vision/ios/mapbox-vision-native-all/0.3.0.podspec?access_token=sk.eyJ1IjoiZWRkeXZlcmJydWdnZW4iLCJhIjoiY2p1c3F5eGVpMDA1eTRlbzJpOXJwdDIxMCJ9.OZRITqde9clot1E8Za_OsQ'
end
This error occurs if the token is invalid.
I tried accessing the link from the error and it says that the token is invalid.

'RCTBridgeModule.h' file not found

I using expo version of react native 0.48.4 (21.0.2 expo) and react-native-in-app-utils#5.6.0. When I link using react-native install react-native-in-app-utils.
Till now I have tried:
Manually Linking
Deleting node_modules and installing again
Including react to the build scheme with parallelized build unchecked
Tried to add react to search header path
But still, the stubborn error does not go away.
My pod definition for react is like so:
pod 'React',
:path => "../node_modules/react-native",
:subspecs => [
"Core",
"BatchedBridge",
"ART",
"RCTActionSheet",
"RCTAnimation",
"RCTCameraRoll",
"RCTGeolocation",
"RCTImage",
"RCTNetwork",
"RCTText",
"RCTVibration",
"RCTWebSocket",
"DevSupport",
"CxxBridge"
]
Can some help me?
I got it working by installing the lib from cocapods instead of linking it by react native like so:
pod ‘react-native-in-app-utils’,
:git => “https://github.com/chirag04/react-native-in-app-utils”
Hope this is helpful to anyone.

Uploading library to cocoa pods

I have created a library in Swift and is trying to upload the library to cocoapods(I am not sure if this is possible, but I assume it has to be). I have never uploaded a library to cocoapods before, so I am unaware of how to do this. I already have the library up in GitHub.
This is what I tried:
Opened the terminal and typed in the following command:
pod spec create JHProgressHUD
This created a JHProgressHUD.podspec file. I replaced the entire default contents of the file with the following:
Pod::Spec.new do |spec|
spec.name = 'JHProgressHUD'
spec.version = '1.0.0'
spec.license = { :type => 'MIT' }
spec.homepage = 'https://github.com/harikrishnant1991/JHProgressHUD'
spec.authors = { 'Harikrishnan T' => 'harikrishnant1991#yahoo.com' }
spec.summary = 'IOS HUD Swift Library'
spec.source = { :git => 'https://github.com/harikrishnant1991/JHProgressHUD.git', :tag => '1.0.0' }
spec.ios.deployment_target = '7.0'
spec.platform = :ios, '7.0'
spec.source_files = 'JHProgressHUD.swift'
end
Then I tried the following command:
pod spec lint JHProgressHUD.podspec
But I am getting the following error:
-> JHProgressHUD (1.0.0)
- ERROR | [xcodebuild] error: /Applications/Xcode 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: unknown option character `X' in: -Xlinker
Analyzed 1 podspec.
[!] The spec did not pass validation.
What is causing this error? Since this is the first time I am trying to add a library to cocoapods, I am not sure if this is happening since this is a swift library. I have tried the library in a project and it is compiling and running fine. Can anyone guide me on how to add a library to cocoapods? I have found only a few number of tutorials and none of them was much helpful. Is it possible to add a swift library to cocoapods?
I don't know if the same problem with you
Error when compiling a static library using Swift "unknown option character `X' in: -Xlinker"
https://github.com/CocoaPods/CocoaPods/issues/2226
they still working on it https://github.com/CocoaPods/CocoaPods/issues/2272
there is an alternative for upload your swift library
http://www.swifttoolbox.io/
https://www.cocoacontrols.com/

Resources