'pod install' doesn't update an existing pod - objective-c

I am trying to update my pod using pod install and finding that it doesn't update properly unless I delete the original pod.
Is there some extra step required or is there a common mistake that makes updates fail?

I'm not sure from which version, but if you update your cocoapods installation to the latest version, you'll find two new commands to help with this.
pod outdated
This will list all pods that have updates available.
pod update
This will update the pods listed in the previous command

You can add the verbose tag and see if there is an error showing up during the update.
pod install --verbose
Using --verbose is the best way to find out what is going on. Maybe there is a problem with the repo it is trying to update from. Hard to say.

I think reader of this Question must understand difference between
pod install vs. pod update
Many people starting with CocoaPods seems to think that pod install is only used the first time you setup a project using CocoaPods and pod update is used afterwards. But that's not the case at all.
Use pod install to install new pods in your project. Even if you already have a Podfile and ran pod install before; so even if you are just adding/removing pods to a project already using CocoaPods.
Use pod update [PODNAME] only when you want to update specific pod to a newer version.
Use pod update only when you want to update every pod to a newer available version.
Every time the pod install command is run — and downloads and install new pods — it writes the version it has installed, for each pods, in the Podfile.lock file. This file keeps track of the installed version of each pod and locks those versions.
When you run pod install, it only resolves dependencies for pods that are not already listed in the Podfile.lock.
For pods listed in the Podfile.lock, it downloads the explicit version listed in the Podfile.lock without trying to check if a newer version is available
For pods not listed in the Podfile.lock yet, it searches for the version that matches what is described in the Podfile (like in pod 'MyPod', '~>1.2')

If your project is configured correctly, you should be able to delete the entire Pods directory and run pod install. I find that this is sometimes the best solution when having issues with pods not being installed properly.
Note: If you begin getting errors such as this when you build:
diff: /../Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
... you may need to close and reopen the project in Xcode.
Warning: make sure all the files in your Pods directory are going to be recreated before deleting the Pods directory. (I.e. make sure you didn't manually modify or add files to the Pods directory.)

Related

Xcode builds successfully a corrupted archive, not showing in organizer, as soon as cocoapods installs react-native-mapbox-gl from Podfile

The problem seems not new, as here, but the solutions proposed didn't work.
I tried also several other approaches to understand what's going on (see here).
To replicate, this is the process:
I have a working iOS App written in Swift.
I follow the description to integrate this app with Native React this procedure
I add to the package.json the following dependencies, and run yarn install:
"#react-native-mapbox-gl/maps":"^8.1.0-rc.9",
"prop-types": "^15.6.2",
I run pod install --repo-update and Archive on Xcode.
OUTPUT: At this point the organizer displays my Archive.
I implement a basic view on mapbox following this procedure
I add to the Podfile requiring use_framework!, as described here or after use_framework!, no difference in the result after I hit pod install --repo-update.
I hit Archive on Xcode.
OUTPUT: the archive is generated successfully, but doesn't show up on the organizer. If I try to open it, the archive is corrupted.
If I remove the pod file of mapbox and I Archive the project after hitting pod install --repo-update, the archive works and shows up in the organizer. Here the same description.
The project runs both as debug and release on a real iPhone 8. Mapbox works well. However, it doesn't work on simulator, nor archive. I can leave with the former, but I can't push on App store because of the latter.
I would not give up as Mapbox is very nice and provides lots of features. What could it be?
SOLUTION :
sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.9.3
rm Podfile.lock
rm -rf Pods
pod install
LAST MESSAGES :
Same here. Impossible to find any solution.
Xcode is building a incomplete archive file. (By incomplete, I mean that in the archive package, some files are missing, like info.plist)
If this can help, I'm using MapboxGL too.
Edit :
Found this https://github.com/react-native-mapbox-gl/maps/issues/1097#issuecomment-725689831
Edit 2:
This link was the solution !
I got the exact same problem with :
#react-native-mapbox-gl/maps": "8.1.0"
COCOAPODS: 1.10.1
Xcode 12.4
The archive was corrupted (missing parts like the plist)
The trick for me was to remove the copy dsym build phase of the #react-native-mapbox-gl-mapbox-static pod
This phase was causing build failure with some config and malformed archive with others, I don't really get the crux of the problem but may be it can help some of you...
It looks like mapbox issue. I had the same issue and instead of downgrading the cocoapods I used this solution:
Edit your package.json, set:
"#react-native-mapbox-gl/maps": "^8.2.0-beta1",
2. Run yarn install or npm install.
3. Put the code into your ios/Podfile between pre_install do |installer| and end:
$RNMBGL.pre_install(installer)
And between post_install do |installer| and end:
$RNMBGL.post_install(installer)
Run cd ios && pod install
After these steps I was able to generate to archive.

React Native - pod install issue "cannot load such file.......node_modules/react-native/scripts/react_native_pods"

when I have a react native project....and when I run pod install it gives me the following error
Invalid `Podfile` file: cannot load such file -- /myPath/node_modules/react-native/scripts/react_native_pods
Here is my 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'
target 'xs' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
target 'xsTests' 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 these next few lines.
use_flipper!
post_install do |installer|
flipper_post_install(installer)
end
end
target 'xs-tvOS' do
# Pods for xs-tvOS
target 'xs-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
Ive checked and there is no file called react_native_pods in location myPath/node_modules/react-native/scripts/.
Im wondering if its something to do with npm install is not generating correct files.....however I upgraded node to most recent version and then ran npm install
I ran npm audit fix and it added react_native_pods file and pod install then worked
Run npm audit fix ==> cd ios ==> pod install
If npm audit fix is not working for you then try below solution.
- sudo gem install cocoapods
- npm i
- cd ios
- pod install
It can also be that you just forgot to run yarn / npm before running pod install.
I have meet the same error, solved by upgrade the version of React Native from 0.62 to 0.63, it works for me
Because of the file react_native_pods does't exists in the folder scripts when the version is 0.62, It appears when I upgraded the version of RN to 0.63, after npm install , It works when pod install, hope it would help other who encounter the same error
I just did npm install before running pod install and it solved for me.
In my case Ive deleted yarn.lock, podfile.lock and it worked fine after yarn and pod install again
in order to fix this: what i did is:
react-native upgrade: It mainly upgrades react-native version, which will also upgrade some of your ios files such as Podfile amongst other things.
Try if this works for you or not. You can also create a latest react native project and compare your files/directories using "Beyond compare", also you need to rename some lines in your files.
Also read the comments in files for better understanding.
This wroked for me:
cd ios
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install
Via this link.
I had this error in 2022 and this was the most relevant search result and didn't fix it.. so in case anyone else out there is running into this, I fought this for days and finally fixed it by:
Creating a brand new directory by: expo init new-project and then copy over your .js files, screens, and assets etc. Do this by hand, don't copy any of your lock files or node-modules or anything else. Just the files that you created/touched yourself. Then expo start. Load the project on your mobile / simulator and when it fails with a module requirement missing add it individually. Repeat this start-error-add until the build succeeds. This was the only way I found to get it working.
Make sure you've installed your npm dependencies.
Run following command and then install pods.
To install npm packages:
yarn install
And then, remove old pod cache:
cd ios && pod deintegrate && rm -rf Podfile.lock
To update pods and start ios:
pod install --repo-update && cd .. && react-native run-ios
Yarn
cd ios
pod install
Works for me
just install,
#react-native-community/cli-platform-ios
in package.json
then yarn install in your root and cd ios and also arch -x86_64 pod install
verify that you have a node_modules folder, I was missing that
Go and add react-native.pods.rb file inside of Node_Module->React-Native->Scripts->(add here)

AppCenter doesn't seem to run pod install despite existence of Podfile

I've got a react-native app that builds on AppCenter. I have a Podfile in my /ios directory, and locally, I can run pod install. The AppCenter documentation says that "App Center scans the selected branch and if it finds a Podfile, it will automatically do a pod install step at the beginning of every build. This will ensure that all dependencies are installed.", but as far as I can tell, it's not running pod install for my build and the build fails for that reason.
Tried adding pod install to a pre-build script, in which case the build succeeds.
Make sure the Cocoapods version running on the build agent matches the one on your podfile.lock.
You can add a post clone script like this on your ios/ folder:
appcenter-post-clone.sh This will automatically install the matching cocoapods version.
Push that file to your repo, then make sure you open the build configuration and hit Save and Build.
It appears that in addition to having a Podfile, you must NOT have a ios/Pods folder present. In my case, I also had to explicitly add that folder to my .gitignore

Vue-native-script / environment not working

When I run
tns run ios --bundle
Output:
Skipping node_modules folder! Use the syncAllFiles option to sync files from this folder.
Searching for devices...
Preparing project...
Installing pods...
Analyzing dependencies
[!] Unable to find a specification for Socket.IO-Client-Swift (~> 11.0)
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.
Note: as of CocoaPods 1.0, pod repo update does not happen on pod install by default.
[!] Automatically assigning platform ios with version 9.0 on target fitness because no platform was specified. Please specify a platform for this target in your Podfile. See https://guides.cocoapods.org/syntax/podfile.html#platform.
Unable to apply changes on device: F5BCC0F3-70B6-40D9-AF43-CBEBE1CEDFB5. Error is: 'pod install' command failed..
Do the pod install manually to check where is the problem:
Remove your current build: tns platform remove ios
Build the app source code only: tns build ios --bundle
Navigate to the project folder platforms/ios, run pod install to see if there is error. If it's still same error, remove Podfile.lock if any, then try pod repo update

CocoaPods "editable" mode?

Python's Pip has an -e flag that can be used to install the package as a full git repo so it can be worked on and changes pushed back to origin master. What's the equivalent command for CocoaPods?
Is there a way to install a pod as a full git repo/submodule so commits can be made?
Use --no-clean when using pod install and pod update. This will keep the .git folder in Pods/[YOUR_POD] to allow you to commit/push directly from it.
Note: This currently does not work for SVN-backed pods as of 0.28 as cocoadpods uses the svn export command.