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.
Related
I've created a React-Native application as of 0.70.6, went through the grief of cocoapods and everything that comes with development on Apple's silicon chips (M2) and got it working and have done quite a bit of work on the project, and then (after creating a GitHub repo) handed it off to a coworker to do some design work (who is on an M1) ...had many issues on their machine as well, but eventually got it working. Now, React-Native 0.71.0 has been released and I ran through all of the steps to upgrade it and got it working on my M2 machine, no issues at all, but after pushing and getting it on their machine, I have not been able to find a solution to the pod install failing due to the hermes-engine not being able to load, a couple of the errors that pop up are,
[!] Failed to load 'hermes-engine' podspec:
[!] Invalid `hermes-engine.podspec` file: undefined method 'exists?' for FileClass.
I have been searching all day for what this means (I am fairly new to React-Native ...and mobile development in general) and I've gathered that 'exists?' has been deprecated as of certain versions of ruby (I'm on 3.2.0) although, it runs fine on my machine, so I am confused as to what could be missing. I've been using chruby to install ruby, and the only difference there is that I have ruby versions 2.7.5 and 2.7.7 on my machine ... but of course, there are flags that I had to set in order to actually be able to install them on my machine and I don't believe they affect my project since bundle install and pod install works using 3.2.0.
To list out what all I have installed on these machines:
bundler -> 2.4.1
cocoapods -> 1.11.3
ruby -> 3.2.0
node -> 18.13.0
xcode -> 14.2 (with command line tools)
Another bit of error reporting, in case it is useful:
Command `pod install` failed.
└─ Cause: Failed to load 'hermes-engine' podspec:
[!] Invalid `hermes-engine.podspec` file: undefined method `exists?' for File:Class.
# from /Users/<user>/projects/<app_dir>/node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec:46
# -------------------------------------------
# source[:http] = "file://#{destination_path}"
> elsif File.exists?(hermestag_file) && isInCI
# Pod::UI.puts '[Hermes] Detected that you are on a React Native release branch, building Hermes from source but fetched from tag...'.yellow if Object.const_defined?("Pod::UI")
# -------------------------------------------
If there is any information that I need to include for clarity, I will update this post as need-be.
I've tried removing the Pods file, and then pod install... same error
Removed Podfile.lock, cache clean AND removing Pods... same error
Removing node_modules/ npm cache clean --force && npm install
then doing npx pod-install to hopefully let node handle things... same error
Ran pod deintegrate and pod install... was scary, broke things, so reverted, back to square 1
There are other things that I've tried earlier today that I cannot remember, and they've gone home, so I can't access all the commands I ran, but these were the freshest, and until I get a more clear view, I'll be trying to get those flags that need to be set to install the older versions of ruby to see if that does anything
One last mention though, we also recently got an M1 Mac Mini, and I ran through all of the steps to get the project working...ended up in the same rut as the other M1, but again, will be trying those LD_FLAGS or whatever it may be and update this thread if that is what fixes the issue
Looking at older issues related to these, people found work-arounds using -x86_64 commands, and I've managed to get this far without any since maintainers have released newer versions with arm64 support, but if I need it anywhere, so be it, I'll take what I can get at this point
Without needing to install other versions of ruby or anything, I got it install the hermes-engine pod by doing something I find dirty...which is just go into that file it mentions and remove the 's' in exists? so it just says exist? and then I also downgraded cocoapods from 1.11.3 to 1.11.2 and seeing how that .podspec file is laid out, it conditionally loads the engine by first seeing if is downloaded on the machine, and then once it sees that it is not, that's where it eventually hits this problem code with the exists conditional...so it downloaded everything and worked fine and I was able to build and run my app on the mac mini...but when trying the same steps on the other m1 machine, I got a very useful error -- Oh no, an error occured ...perfect, and now I am questioning if these changes I have made will effect the M2 pod commands
If there is no better answer provided in the next few days, I'll assume this is the best possible fix until react-native upgrades their ruby version to 3.2.0 which after some more digging...is the exact release that this exists? file method was removed
But would still love feedback for anyone else using an M1 MacBook who has had these issues on the stable release of React-Native 0.71.0
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.
I'm using RealmSwift as a database in my swift project. Today, after opening my project in Xcode-beta version 11, my app crash with this error:
Terminating app due to uncaught exception 'RLMException', reason: 'Primary key property 'name' does not exist on object 'RealmSwiftPermissionRole''
My app works properly on the previous version of Xcode(10.2.1).
RealmSwiftPermissionRole is a class from the Realm and I don't have access to it. Maybe in their feature updates, they fix this bug but for now, I search a lot but didn't find any solution.
(I clean the project, delete the app from the simulator, and run the project again but nothing changed.)
Any suggestion?
There's an issue with iOS 13 and Xcode 11 which may cause this problem. All String properties of Realm classes with a default String value set are disregarded somehow.
You can fix this by updating to the latest version (currently 3.20.0) and then on Xcode: Product -> Clean Build Folder.
If you're using cocoa-pods:
Open your project's Podfile, and replace RealmSwift line with:
pod 'RealmSwift', '~> 4.4.1'
Then, open terminal on the project's folder and:
pod repo update
pod install
Developers of Realm have started working on Xcode 11 compatibility. From that page...
Using Realm with Xcode betas requires building from source, and typically will require using dev branches rather than releases.
Carthage
github "realm/realm-cocoa" "tg/xcode-11-b1"
DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer carthage bootstrap -no-use-binaries
CocoaPods
pod 'Realm', git: 'https://github.com/realm/realm-cocoa.git', branch: 'tg/xcode-11-b1', submodules: true
pod 'RealmSwift', git: 'https://github.com/realm/realm-cocoa.git', branch: 'tg/xcode-11-b1', submodules: true
Explicitly including the Realm pod as a dependency is required as otherwise it'll try to use the latest release of the obj-c part.
Note that last sentence. You must include the Realm pod as a dependency or it'll use the non-beta version and it won't work.
I had run into the same issue with RealmSwift 4.3.1, the problem was I forgot to mark the property as #objc
#objc dynamic var id = ""
Try deleting and reinstalling your application too.
For me,
Updating the Realm to pod 'RealmSwift', '~> 3.20.0'
and update the pod install
Works for me.
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.
I'm seriously stuck with CocoaPods. Please help!
Can someone please tell me where i'm going wrong? I'm doing an online Objective-C course. I've been stuck on CocoaPods for far too long. I completed the CocoaPods course and seem to have installed everything correctly.
I have followed these steps in line with this tutorial:
1) I created a podfile within the PhotoBombers Xcode project.
2) Within Xcode I clicked on the podfile, then entered: pod 'SimpleAuth/Instagram'
3) I then searched for the Terminal using Spotlight. Within the terminal I then entered 'pod' and pressed enter (as shown in the tutorial), however the following code appeared and looked nothing like the code in the tutorial:
Usage:
$ pod COMMAND
CocoaPods, the Cocoa library package manager.
Commands:
cache Manipulate the CocoaPods cache
init Generate a Podfile for the current directory.
install Install project dependencies to Podfile.lock versions
ipc Inter-process communication
lib Develop pods
list List pods
outdated Show outdated project dependencies
plugins Show available CocoaPods plugins
repo Manage spec-repositories
search Search for pods.
setup Setup the CocoaPods environment
spec Manage pod specs
trunk Interact with the CocoaPods API (e.g. publishing new specs)
try Try a Pod!
update Update outdated project dependencies and create new
Podfile.lock
Options:
--silent Show nothing
--version Show the version of the tool
--verbose Show more debugging information
--no-ansi Show output without ANSI codes
--help Show help banner of specified command