Modifying Check Pods Manifest.lock script in build phases of Xcode - xcode

pod install adds a script to the build phases to check for the Manifest.lock file. It throws an error if the sandbox is not in sync and exits the process. Is there any way to modify this script such that on error I want to perform "pod install".

Related

Command CompileSwift failed on archiving build on Jenkins

In our project we have CI setup on M1 processor. We use fastlane to automate build publshing and Jenkins to run bundle install --path vendor/bundle + bundle exec fastlane build upond each commit. The local archive via fastalne works fine on M1 process. We don't have any problem with it. Once, we run our pipeline on CI the Command CompileSwift failed with a nonzero exit code appears. The errors reference to several files from third party libaries which added with cocoapods (Kingfisher, Stripe, FBSDKShareKit). Any thoughts why does the error reprodicible only on CI run not on local execution of the same commands via consloe?
cocoapods: 1.10.2
The issue has been resolved by myself. I figure out that my project has an inaccurate build script to rename image assets to lowercase. The build script has a "Based on dependency analysis" checkmark enabled. Consequently, upon clean install on Jenkins, it always failed, but in fact succeeded on the second run.

How to fix 'ReactCommon/CallInvoker.h file not found' after manual upgrade from v0.61.5 to v0.63.3

I had to manually upgrade react-native, because nix react-native upgrade failed.
After following the Upgrade Helper for v.0.61.5 -> v0.63.3, ive cleaned my build folder and tried to run the application, only to get a failed build
the error is:
Lexical or Preprocessor Issue: 'ReactCommon/CallInvoker.h' file not
found ->
NativeToJsBridge.h
why is this happening? comment for additional environment/file information
Go to the ios/ directory in your project.
Delete Podfile.lock and Pods/ directory, then run pod install --repo-update.

Is there a way to avoid running `pod install` manually and not commiting Pods directory at the same time?

On my current project I am asked not to commit my Pods directory, and at the same time, guys want me to 'add some script' to XCode build phases which will run 'pod install' automatically before each installation if needed.
The goal is not to run pod install manually in terminal after you clone the repo.
I have spend a day trying to solve this and I've found a couple of references with no much detail:
iOS using pod install as Pre-action run script for building the project
CocoaPods version control, must use pod install when cloning repo
I've also found out that for CI the same problem is solved by setting actions in .yml file:
Travis-CI is unable to open file
Do you know what this kind of script could look like?
Maybe it would be best if this could be separated in 2 different questions.
But now that we are here already, to avoid the pods directory on your repository, add this line to your .gitignore file:
Pods/
For your second question regarding running pod install. On Xcode:
Click your scheme icon on the top left and select "Edit Scheme..."
Alternatively select from the menu "Product -> Scheme -> Edit scheme..."
In Scheme Window expand "Build"
Select "Pre-actions"
Click on + and choose "New Run Script Action"
Select to provide the build settings from your target
Add the script:
cd ${PROJECT_DIR}
test -e Pods || pod install && sleep 30
Description of the script:
Changes directory to the project's main folder
Checks if there is a file or folder named Pods, if not runs pod install and waits 30 seconds (before continue with the build). You might want to adjust to wait more or less, according to how long you need to wait for the pods to be downloaded.

Issues with adding a pod file to my Xcode project

I've been trying to create a pod file for my project in my directory using the terminal, but I'm running into the issue shown below, any suggestions?
I tried restarting my Mac and even tried to add one to a different project but to no avail. Also couldn't seem to find any other instances of this occurring.
Here's the terminal output:
Matts-Mac-mini:~ sarabytestudios$ cd /Users/sarabytestudios/Desktop/Blurr\Messenger/Blurr\ Messenger.xcodeproj
Matts-Mac-mini:Blurr Messenger.xcodeproj sarabytestudios$ pod init
[!] No xcode project found, please specify one
Matts-Mac-mini:Blurr Messenger.xcodeproj sarabytestudios$
You have to create your PodFile in the same directory as your Blurr Messenger.xcodeproj.
In your case should be in /Users/sarabytestudios/Desktop/Blurr\Messenger/.
In that directory, create a file called PodFile where you must declare the cocoapods you want to include in your project (you can do it by hand or call pod init). The you must type pod install.
After that, you must open the new generated file called Blurr Messenger.xcworkspace.
1) Run 'pod init' command inside the project directory(directory containing YourProject.xcodeproj file)(This will create a Podfile, a YourProject.xcworkspace file, Podfile.lock file and a Pods folder)
2) Run 'pod install' command inside the same directory.
3)Open your project using YourProject.xcworkspace file and NOT the YourProject.xcodeproj file(otherwise build fails).

continuous integration with XCode bots and cocoapods

I'm having problems with bots occasionally failing when building.
A pre build action is used to install the pods, this works well some times. However when the integration fails it's because of this error:
Installing Pods
Analyzing dependencies
Downloading dependencies
[32mInstalling AFNetworking (1.3.3)[0m
...
2014-03-07 10:40:25.667 xcodebuild[76637:100b] [MT] IDEFileReferenceDebug: [Load] <IDEFileReference, 0x7fa3fe5b0840: group:Pods/Pods.xcodeproj> Failed to load container at path: /Library/Server/Xcode/Data/BotRuns/Cache/5bbd629b-a843-42b0-8b52-256db7560be5/source/Pods/Pods.xcodeproj, Error: Error Domain=Xcode3ProjectErrorDomain Code=2 "Project /Library/Server/Xcode/Data/BotRuns/Cache/5bbd629b-a843-42b0-8b52-256db7560be5/source/Pods/Pods.xcodeproj cannot be opened because it is missing its project.pbxproj file." UserInfo=0x7fa3fe7e54b0 {NSLocalizedDescription=Project /Library/Server/Xcode/Data/BotRuns/Cache/5bbd629b-a843-42b0-8b52-256db7560be5/source/Pods/Pods.xcodeproj cannot be opened because it is missing its project.pbxproj file.}
Generating Pods project
Integrating client project
So my guess is that xcodebuld tries to read the Pods-project before it's done being generated.
Does this sound like a reasonable guess?
And would anyone know how to solve it?
EDIT
Pre-action build script looks lie this
cd $SRCROOT
export LC_ALL="en_US.UTF-8"
if [ -d Pods ]
then
echo "Updating Pods"
pod update
else
echo "Installing Pods"
pod install
I made the xCode server work with cocoapods pretty seamlessly, have a look at my article, it may help you.
http://papaanton.com/setting-up-xcode-6-and-apple-server-4-0-for-continues-integration-with-cocoapods/
I do the clean build every time with Pod install.
It maybe the reason.
CocoaPods is really undependable with Xcode bots in general when the pod project is not being tracked by your SVN. I also do not track the pod project and have similar troubles with CocoaPods. If you are looking for a temporary fix, you can go to /Library/Server/Xcode/Data/BotRuns/Cache/5bbd629b-a843-42b0-8b52-256db7560be5/source/, run pod install from there and remove the pre-build script. Though if you update your Podfile or Podfile.lock, you will have to manually run pod install/pod update on the server again.

Resources