Someone ran 'pod update' and now my app crashes with podfile.lock issue - xcode8

We have gone through all the steps a million times:
$ sudo gem install cocoapods
$ rm -rf Bizzy\ Books.xcworkspace
$ pod install
Deleting derived data... changing build settings...
NOTHING is working! And all because one guy ran "pod update" and then didn't know what to do after that!
This is the error code:
PhaseScriptExecution [CP]\ Check\ Pods\ Manifest.lock
/Users/Owner/Library/Developer/Xcode/DerivedData/Bizzy_Books-ajpeiroanshownarpormfcnuuvik/Build/Intermediates/Bizzy\
Books.build/Debug-iphoneos/Bizzy\
Books.build/Script-76499205B9A6D7551C8D0832.sh
cd "/Users/Owner/Desktop/Bizzy Books"
/bin/sh -c \"/Users/Owner/Library/Developer/Xcode/DerivedData/Bizzy_Books-ajpeiroanshownarpormfcnuuvik/Build/Intermediates/Bizzy\
Books.build/Debug-iphoneos/Bizzy\
Books.build/Script-76499205B9A6D7551C8D0832.sh\"
diff: /Podfile.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.
I am looking for somebody that knows what they are doing on this!
Plus, people are blaming me for having "old code" which is only like a week or two since the last pod install in which I had no problems. And there are no errors shown with the code, only with the podfile.lock issue.
And people are downloading from Github and saying it works fine therefore I have no problem, which doesn't help me, because when I pull from Github, it makes no difference, showing the same error!
Here is the github repository:
https://github.com/caldwbr/Bizzy-Books-iOS

Well I finally got it working.
I opened the folder for my app and deleted Bizzy Books.workspace, Podfile, Podfile.lock, and the Pods folder, and emptied the trashcan. (Fairly important, if you don't want to see a slew of red untracked files hanging around after you do 'git status')
Then I navigated inside terminal to this same folder and ran:
git fetch --all
git reset --hard origin/master
Then I tested, and it worked!
I had been doing "git fetch --all" followed by "git pull --hard origin master," but I needed to do "git fetch --all" followed by "git reset --hard origin/master" and MAKE SURE NOT to do any "pod install" or "pod update"! That is the command that is giving me grief!
So thankful this is fixed!!!
There must be some incompatibility with a newer version of on of the pods in my podfile that just isn't working, hence I have to go back to the older version of that pod (not of cocoapods itself I don't think). Or there may be an issue with podfile.lock being funky as when you run 'pod update' or 'pod install' it generates a new podfile.lock file.

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.

Incorrect path for Pods-testAppTests/Pods-testAppTests.debug.xcconfig: unable to open file

So I recently uploaded my react-native project on GitHub, then cloned it back to see how it will build(did it for first time... yeah). And on react-native run-ios I got a repetitive error: "react-native-app/ios/Pods/Target Support Files/Pods-testAppTests/Pods-testAppTests.debug.xcconfig: unable to open file (in target "testAppTests" in project "testApp") (in target 'testAppTests' from project 'testApp')
I found a solution, where this:
cd ios
pod deintegrate
pod install
helped me as the project then built and ran correctly.
So my question is, how to upload it to GitHub in a way so it builds always correctly after cloning it?
Update
Checking and editing .gitignore solved this problem.
Maybe this is linked to files which have been added/committed, while they should have been ignored, private and local only (not uploaded to GitHub)
Check your .gitignore: here is one for ReactNative, as explained in "Creating a .gitignore for a Clean React Repository", blog post written by Parker Johansen.
Then, assuming you don't have any pending changes/work in progress, you can, as explained here, apply your new .gitignore to your existing repository:
cd /path/to/local/cloned/repo
# create your .gitignore
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
git push
Finally, clone it again, and see if it compiles better.
The OP adds in the comments:
I found that folder 'Pods' doesn't exist on GitHub, that's why this error occurs, how can I add it to my /ios folder on Github correctly
I advise to check if there is a .gitignore rule which would ignore said folder:
git check-ignore -v Pods/aFile_inside_Pods

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

update the version in package.json without clean git working directory (without a task runner like Gulp)

When running a: npm version prepatch I get the error: "Git working directory not clean." And then a list of files that aren't committed yet.
However, I'd like to do this prerelease to test some stuff locally using a private npm registry. Meaning that I don't have to commit the files just yet using Git.
Is it possible to update the version in package.json without clean git working directory?
From the npm version documentation at https://docs.npmjs.com/cli/version:
If run in a git repo, it will also create a version commit and tag. This behavior is controlled by git-tag-version (see below), and can be disabled on the command line by running npm --no-git-tag-version version. It will fail if the working directory is not clean, unless the -f or --force flag is set.
I'm not 100% certain whether you just need --no-git-tag-version, or if you'll also need the --force flag.
You can use git stash.
E.g.
git stash
npm version patch
git stash pop
This will reset your working directory temporarily (remove uncommitted changes). Then you can run npm version {major|minor|patch}. Afterwards, using git stash pop will re-apply your uncommitted changes to your working directory.
Tutorial: https://www.atlassian.com/git/tutorials/saving-changes/git-stash#stashing-your-work
Try to commit first
git add . && git commit -am "new version"
and then
npm version patch

'pod install' doesn't update an existing pod

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.)