Keeps installing Firebase 2.5.1 instead of the latest version with Cocoapods installation - xcode

Basically I did as instructed by the firebase.google.com website on how to set up. Everything sets up alright, until I tried to FIRApp.Configure() in the App Delegate. Received an error. Reinstall the Cocoapods to realize the version is 2.5.1 which I don't believe is the latest version. So how do I get the latest version is my question?
Note: Using Swift, pod search only shows 2.5.1 as latest.
Pod file:
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
target 'OptionMeFood' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for OptionMeFood
pod 'Firebase'
end

Just put this in your Podfile without a version number, It should then load the latest version (3.2):
pod 'Firebase'
See here: https://firebase.google.com/docs/ios/setup#add_the_sdk
This will add the latest version of the Firebase pod, which include the /Core subspec. This provides Firebase Analytics. A list of currently available pods and subspecs is provided below. These are linked in feature specific setup guides as well.

Related

Library not loaded: #rpath/hermes.framework/hermes

I have enabled Hermes in my react-native(v0.64) Application. Everytime I run app I get following stack trace.
dyld: dyld cache load error: shared cache file open() failed
dyld: Library not loaded: #rpath/hermes.framework/hermes
Referenced from: /Users/sharktank/Library/Developer/CoreSimulator/Devices/A32F4931-51A8-4D22-AEFB-625F834CE221/data/Containers/Bundle/Application/71773888-08D5-4B82-9545-07F6B1538864/COSPM-DEV.app/COSPM-DEV
Reason: image not found
dyld: launch, loading dependent libraries
DYLD_SHARED_CACHE_DIR=/Users/sharktank/Library/Developer/CoreSimulator/Caches/dyld/20E232/com.apple.CoreSimulator.SimRuntime.iOS-14-4.18D46
DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
DYLD_LIBRARY_PATH=/Users/sharktank/Library/Developer/Xcode/DerivedData/COSPM-atbujvbobdbyehckyoqrdgmqiubm/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSim
(lldb)
I have enabled hermes in Podfile and after pod install pod is available in Pods folder.
Project is in monorepo architecture along side another projects. Another app enabled with Hermes in same mono-repo package is working fine without crash.
Podfile:
require_relative '../../../node_modules/react-native/scripts/react_native_pods'
require_relative '../../../node_modules/#react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'COSPM' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => true
)
pod 'RNVectorIcons', :path => '../../../node_modules/react-native-vector-icons'
# Firebase
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'CodePush', :path => '../../../node_modules/react-native-code-push'
target 'COSPMTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
use_flipper!()
post_install do |installer|
react_native_post_install(installer)
end
end
I am using Xcode 12.4.
Solutions I tried which did not work:
Clean Pods and npm packages, clean previous build and rebuild
Clear watchman and metro bundler cache and rebuild
I was facing the same problem on react native 0.70
Select App Target then follow the steps
goto Build Phases
Inside Link Binary With Libraries section
Click on Add Items and search for hermes.xcframework and add it
Rebuild application
This resolved my issue in RN 0.70. In Xcode, Targets -> Build Phases -> Link Binary With Libraries
The other answers suggest disabling Hermes or manually adding it as a linked library, but this should not be necessary.
The latest version should install the Hermes framework automatically.
The problem seems to be related to using the incorrect version of CocoaPods and the pods repo.
To bring everything up to date, do the following:
Make sure your Gemfile is up to date for your version of React Native. You can use the Upgrade Helper to see if it needs changed.
Upgrade Ruby to the version listed in your project's Gemfile. (Instructions)
Upgrade CocoaPods to the latest version: bundle install
Update the CocoaPods repo: bundle exec pod repo update
Delete Podfile.lock
Reinstall pods cd ./ios && bundle exec pod install
If you're still getting errors, double check that the correct versions are actually being used (are in your PATH).
I also made a blog post about this error if you would like more details: https://traviswimer.com/blog/cocoapods-could-not-find-compatible-versions-for-pod-hermes-engine/
Update (Jan 17, 2023)
I updated this answer to use the Bundler tool to manage Ruby and Cocoapods versions. The bundle command is now the recommended way to use Cocoapods in React Native projects. It runs commands based on the versions listed in your project's Gemfile (which is updated with each version of React Native). If for some reason you are unable to use bundle, you can manually upgrade Cocoapods using: gem install cocoapods
Then run the other commands without bundle exec. (e.g. pod repo update and pod install
Try following:
Change hermes_enabled value from true to false in Podfile
Reinstall npm/yarn dependencies by (yarn install)
Reinstall pods (cd ios && pods install)
Run app (react-native run-ios)
I tried this a couple of times changing hermes_enabled from true to false and back, and once it starts working.
The right answer depends on your react-native version
This error means that your react-native project is set to use hermes a lightweight Javascript engine created by facebook specially for react-native. It is supposed to make the app faster and lighter.
If you want to use hermes, open your Podfile (ios/Podfile), look for hermes_enabled and set its value to true. The line should look like the following
:hermes_enabled => true
Besides that, you might needs to follow few more steps from the official page.
If your Podfile does not have any hermes_enabled property, please make sure your react-native project is using at least 0.60.
For react-native > 0.60 and < 0.70
follow these steps from the official page.
For react-native >= 0.70
Hermes is the default engine for this version and beyond. Maybe you just need to reinstall your node packages, clean your Podfile.lock and reinstall your pods by running pod install from inside your ios folder.

Trying to Rebuild a Legacy IOS App, Getting Error in Facebook-IOS-SDK Cocoapod

I've been asked to rebuild an existing IOS app that uses Facebook-IOS-SDK. The app is at least 5 years old so I expected things to be deprecated. I have some limited experience with XCode and IOS but I'm far from an expert. I've never used cocapods until today. I installed cocoapods and ran pod init. Facebook-IOS-SDK ver 3.24.4 loaded with no errors (other pods too, including Bolt, with no errors).
I've read the migration notes on the FB dev page regarding the versions and it's implied that I should be able to use 3.24. When I do a clean build I get the error:
(FBRequest *)requestForUpdateOpenGraphObject(id<FBOpenGraphObject>)object
{
return [FBRequest requestForUpdateOpenGraphObjectWithId:object[#"id"] graphObject:object];
}
Expected method to read dictionary element not found on object of type 'id<FBOpenGraphObject>'
This error is in FBRequest.m, the cocoapod code, not in my clients code. This code is marked read only. If this is the correct pod version, and I can't change it then is there some other dependency in the (large) project that needs to be updated?
Podfile:
# Uncomment this line to define a global platform for your project
platform :ios, "9.0"
target "tbd" do
pod 'IQKeyboardManager'
pod 'UICKeyChainStore'
pod 'CocoaLumberjack', '~> 2.0.0-beta'
pod 'SDURLCache'
pod 'HockeySDK'
pod 'Facebook-iOS-SDK', '~> 3.23'
pod 'GoogleAnalytics-iOS-SDK'
pod 'UIActionSheet-Blocks', '~> 1.0'
end
target "tbdTests" do
end
The only, nasty, solution I found is to change the code inside FBRequest.m manually.
Change line 370 from:
return [FBRequest requestForUpdateOpenGraphObjectWithId:object[#"id"] graphObject:object];
to
return [FBRequest requestForUpdateOpenGraphObjectWithId:object.objectID graphObject:object];
this should make you project runs again.
Again, this is not a nice solution, but it works :)
Emilio
if you don't have the need to use Facebook-IOS-SDK ver 3.24.4 you can simply use the latest version 4.36.0.
have a look at your Podfile and see if there is any reference to Facebook-IOS-SDK, if there is something like:
pod 'Facebook-IOS-SDK', '~> 3.0'
you can replace it with:
pod 'Facebook-IOS-SDK', '~> 4.0'
otherwise post your Podfile and we can have a look.
Cheers

Cocoa pod v0.39.0 not working with Xcode 8

My current project using cocoa pods of version 0.39.1, and my current pod version in my system is 1.1.1, so when i try to install the cocoa pods in my project path, it gave me warning saying
[!] Invalid Podfile file: [!] Unsupported options {:exclusive=>true} for target Xxx Xxx XxxxTests..
so i have uninstalled pod v1.1.1 and installed 0.39.1. Now when i run install command i get another warning
[!] The master repo requires CocoaPods 1.0.0 - (currently using 0.39.0) Update Cocoapods, or checkout the appropriate tag in the repo.
i'm aware that Xcode 8: Only works with CocoaPods 1.1.0
Should i update my project pod file to latest pod version or should i work with lower version of xcode so it supports v0.39.0
I recently completed a project where I had to migrate a dozen or so (private) Cocoapods from 0.39 up to 1.1.X.
It's actually not that hard, once you get the hang of it (and, at least in my case, the Podfile I put together for 1.1.X continued to work the occasional times I had to drop back down to Pods 0.39)
As you've discovered, you do need to remove ":exclusive => true" and "link_with" (which gets replaced with abstract_target). More information can be found in this Pods migration guide. Here is another "mini" example.
And other people have asked related questions here before. My recommendation is to go up to Xcode 8, otherwise you'll won't be able to do pod update and keep up to date with the latest changes in the Pods you're trying to leverage in your code.

Xcode 7 - Cocoapod not importing

i am using Xcode 7 Beta3.
I tried to include one dependency, so this is my podfile:
platform :ios, '8.0'
use_frameworks!
target 'Test' do
pod 'Alamofire', '1.2.3'
end
target 'TestTests' do
end
target 'TestUITests' do
end
But when i import this class:
import Alamofire
i get:
No such module Alamofire
Anybody had this issue before?
Thanks and Greetings!
I ran into issues where Xcode 7 Beta 5 (7.1)(newest at the time) mixed with a Podfile would not recognize any of the pods I wanted to import.
Cocoapods updated to fix these issues.
[sudo] gem update cocoapods
Once that was up to date, I checked the git repositories that were included in my Podfile to see if any of them had Swift 2 branches.
After adding the :branch => 'swift-2' to the Podfile for the pod I am using, I was able to make the error in Xcode go away, and import the module.
Based on the comments on your question, Alamofire does have this branch and you should use that.
Run pod update on your project after saving your Podfile.

Integrate Grabkit with cocoa pods in existing project

I have integrated Grabkit in my project via adding submodules. I want to add grabkit via cocoa pods. I surfed web alot. I have created a pod file.
pod 'Grabkit', :git => 'https://github.com/pierrotsmnrd/grabKit.git'
I have downloaded latest podspec file from https://github.com/CocoaPods/Specs/blob/05def154728953519546ee0c648a82f293d02f4f/grabKit/1.4/grabKit.podspec
When I run pod install or pod update I get following error:
$ pod update
Analyzing dependencies
CocoaPods 0.29.0 is available.
Pre-downloading: `Grabkit` from `https://github.com/pierrotsmnrd/grabKit.git`
[!] No podspec found for `Grabkit` in /path-of-my-project/Pods/Grabkit/Grabkit.podspec
Please suggest !!
I'm not sure why you'd want to download the latest podspec. The specs are automatically managed by the pod command line tool and there is a clone of the entire specs repo in ~/.cocoapods. The issue here is the case. It is grabKit notice the lowercase 'g'

Resources