Integrate Grabkit with cocoa pods in existing project - cocoapods

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'

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.

Can't add "MidiParser" pod to Podfile

I am trying to add this github project to my project as a pod: https://github.com/matsune/MidiParser
In my PodFile, I have tried
pod 'MidiParser'
and
pod 'MidiParser', :git => 'https://github.com/matsune/MidiParser.git'
but either time I get the error
Unable to find a specification for 'MidiParser'.
I have tried adding other pods like 'https://github.com/daltoniam/SwiftHTTP' just to see if they work, and they do. I notice there are multiple projects on GitHub called MidiParser, so maybe I need to distinguish between them somehow? The installation instructions in the MidiParser README only give instructions for Carthage. It says to add this line to the Cartfile:
github "matsune/MidiParser"
I also have also tried:
pod 'matsune/MidiParser'
I notice I can't find the project when I search for it here: https://cocoapods.org.
Does that mean I simply can't install the project using Cocoapods, and that I have to do it manually?
Edit: I ended up using Carthage.
CocoaPods requires pods to be specified with a podspec to describe its Xcode workspace integration. See https://guides.cocoapods.org/making/making-a-cocoapod.html

Pod install installs pod from wrong spec repository

We created a private pod called ListKit und put it into our private cocoapods repository.
The Cocoapod Documentation says:
"The order of the sources is relevant. CocoaPods will use the highest version of a Pod of the first source which includes the Pod (regardless whether other sources have a higher version)."
We included both spec sources on top of the Podfile like so:
(our own repo is the first on the list)
source 'ssh://git#stash.mycompany:7999/customspec.git'
source 'https://github.com/CocoaPods/Specs.git'
For some reason ListKit of the Cocoapods Master Spec Repository will be used if i run
pod install
instead of the ListKit from our private spec repository.
Is this intentional or a bug?
I use Cocoapods Version: 1.5.3
on Mac OS 10.13.2
See the doc at https://guides.cocoapods.org/syntax/podfile.html#pod. You can directly set an individual source for a specific pod to disambiguate this situation:
pod 'ListKit', :source => 'ssh://git#stash.mycompany:7999/customspec.git'
As for why it is originally fetching from the second repository instead of the first repository, it may be a bug, or it may be that another pod using the Master Spec Repository had a dependency on 'ListKit', or it may be that no pod matching the requirements of 'ListKit' could be found in the first repo.

Creating new Cocoapod `Unable to find a specification` on pod install

I've gone through the Cocoapod guide for making a new pod.
The repo exists here: https://github.com/kkendall33/QuickInstantiating.
The QuickInstantiation pod spec looks like this:
But when I go to a different project and add QuickInstantiating to the Podfile:
and run pod install. I get this:
I just tested pod install with a different pod and it worked fine. This leads me to believe I'm doing something wrong with mine.
The pod must be pushed before it can be referred to by version. For testing, you can use the same path syntax -
pod 'QuickInstantiating', :path => 'relative/path'
like you used at https://github.com/kkendall33/QuickInstantiating/blob/master/Example/Podfile#L4
Otherwise you can push the pod to a private Specs repo if you do want to test the git repo before pushing the pod to trunk. Instructions at https://guides.cocoapods.org/making/private-cocoapods.

CocoaPods block dependency installation

I haven't found the answer to this within the Podfile docs, so I'm not sure if it's possible.
I want to install a CocoaPods project which has 3 dependencies. I add it to my Podfile:
pod 'IDMPhotoBrowser'
and run install:
$ pod install
Installing DACircularProgress (2.1.0)
…
Installing IDMPhotoBrowser (1.2)
…
Installing SVProgressHUD (0.9)
However, I have a hacked up version of SVProgressHUD in my project which contains code not in the current repo. Additionally, SVProgressHUD 0.9 is from January, and there are months of additional commits since then. I would like to use my manually added version instead.
Can I specify in my Podfile that SVProgressHUD should not be installed, so that my manually added version is used? Or do I just need to delete it by hand every time I run pod install?
Alternatives
I know I could upload my fork to github and do something like:
pod 'SVProgressHUD', :git => '<my git repo>', :commit => '<my sha>'
but I'm hoping to not need to upload code just to get Cocoapods to do what I want.
It's not so much about blocking the dependency as it is overriding it with your own. This means that CocoaPods needs to find your local copy of SVProgressHUD before it activates IDMPhotoBrowser and looks for SVProgressHUD in the master spec repo.
You can achieve the setup you want by declaring your version of SVProgressHUD first in your Podfile using a local podspec:
Your custom version needs to be in a subdirectory of your project, with a valid podspec at the root of that directory, e.g., External/SVProgressHUD/SVProgressHUD.podspec.
Update your Podfile like this:
pod 'SVProgressHUD', :path => 'External/SVProgressHUD' # this needs to be declared first
pod 'IDMPhotoBrowser' # your custom pod will be used as the dependency here
If you don't have a local podspec, you should be able to take a copy of the 0.9 version of SVProgressHUD (and if necessary modify it to compile any new code you've added).

Resources