Cocoapods pod install as a target dependency - xcode

I've created an external build system target in my Xcode project and made it a dependency of the main target, so I want this target run before the main target starts building. In this external build system target I simply reference a bash script to run pod install from the SRCROOT dir.
As expected, my new target runs first and Pod install runs fine but then the build stops. It does not fail however, it just reports the Build stopped with no issues. The exit code from pod install is 0 so the script should return as successful yet the build stops.
Does anyone know why this may be happening?

I tried to implement the same functionality directly in CocoaPods and experienced the same behavior. I think that Xcode aborts the build as CocoaPods performs changes in the Pods project, which is recreated from scratch at the moment.
This approach might be viable once we start to edit in place the Pods project in CocoaPods.

Related

Xcode MDFInternationalization run script build phase 'Create Symlinks to Headers Folders' will be run during every build because

I have a warning in Xcode for MDFInternationalization, it's a dependency of something else in my Xcode project.
Full Warning : "Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase."
Unlike other pods there is no possibility of unchecking the option mentioned. There isn't a specific build phase for the pod in question.
I would be quite happy to just hide the warning if possible too.
I have tried adding the run scripts detailed here to no avail. The errors still appears after deintegration.
warning build: Run script build phase 'Module' will be run during every build because it does not specify any outputs. To address this warning
Any help appreciated.
Thanks
I get the same warning(s) - I get 5 of them and similarly I am unable to find anything in the build phase that references anything relevant. I don't recall seeing these warnings before the last Xcode update... I haven't found any resolution yet either but just wanted you to know you're not alone...
Actually I just solved this one for myself. I sensed that the "Run script build phase 'Create Symlinks to Header Folders' warnings that I was receiving were related to Google firebase which I no longer use (deleted it a couple of years ago from my project). Thus I checked my pods and I still had a number of google and firebase pods within the Pod section of my Xcode project.
Thus, I went to a terminal window and into my project directory and edited my Podfile which was still referencing a number of google / firebase pods that I no longer used so I removed/deleted these. I saved the Podfile and then issued a pod install command... the system removed the pods... I went back into my Xcode project, recompiled and hey presto - the 5 warnings that I was getting that said "Run script build phase 'Create Symlinks to Header Folders" had gone...

Pod files are missing

I am new in iOS dev, but I need to build a certain project. The problem is that when I click on the build button xcode fails and one of the errors says
Unable to load content of list : path_to_pod_file
as well I see that in project structure xcode marked missing files with red color
I read about pod files and understood that it is a kind of configuration file, so the question is: are these files should be generated by build (somehow) or it is files that I hadn't received with a project and there is no way to generate them?
I found a solution here:
https://medium.com/#soufianerafik/how-to-add-pods-to-an-xcode-project-2994aa2abbf1#
Actually, the files I asked for above are generated and I needed to install the pod and run the Pod file which (in my case) was under my project structure.
sudo gem install cocoapods
cd PATH_TO_YOUR_PROJECT_FOLDER
pod init (IN CASE IF YOU HAVEN'T ALREADY HAVE IT)
pod install
Double click on the Xcode workspace to open the project
You can clean/re-build your project and run it.

XCTest: running tests fails with Cycle inside X; building could produce unreliable results in project with CocoaPods and Carthage

After upgrading my project to Xcode 12, the test suite stopped working. The tests target doesn't compile, fails with:
Cycle inside <redacted>Tests; building could produce unreliable results. This usually can be resolved by moving the shell script phase '[CP] Embed Pods Frameworks' so that it runs before the build phase that depends on its outputs.
Cycle details:
→ Target '<redacted>Tests' has copy command from '/Applications/Xcode12.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework' to '<redacted>/Library/Developer/Xcode/DerivedData/<redacted>-bxjgdjscysiavpfrzmquaqdkncsl/Build/Products/Debug-iphonesimulator/<redacted>.app/Frameworks/XCTAutomationSupport.framework'
○ Target '<redacted>Tests': CodeSign <redacted>/Library/Developer/Xcode/DerivedData/<redacted>-bxjgdjscysiavpfrzmquaqdkncsl/Build/Products/Debug-iphonesimulator/<redacted>.app/PlugIns/<redacted>Tests.xctest/Frameworks/CryptoSwift.framework
○ That command depends on command in Target '<redacted>Tests': script phase “[CP] Embed Pods Frameworks”
The script is the last build phase in the target so I'm a bit lost. Any clue? Thank you.
I found a solution for my issue. The error is mentioning CodeSign and it is related with Frameworks/CryptoSwift.framework (this framework is linked using Carthage), so I guessed that it has nothing to do with CocoaPods but with the way that Carthage frameworks are included in the test bundle.
Just remove the "Code Sign On Copy" from the Carthage build phase.

Using 'GoogleMaps' and 'GooglePlaces' pods, when archiving iOS build receive error for multiple commands produce GoogleUtilities target

Having trouble archiving - I receive a Build System Information error that says
Multiple commands produce '.../Library/Developer/Xcode/DerivedData/.../Build/Intermediates.noindex/ArchiveIntermediates/.../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework':
1) Target 'GoogleUtilities-00567490' has create directory command with output '.../Library/Developer/Xcode/DerivedData/.../Build/Intermediates.noindex/ArchiveIntermediates/.../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework'
2) Target 'GoogleUtilities-ac14cd06' has create directory command with output '.../Library/Developer/Xcode/DerivedData/.../Build/Intermediates.noindex/ArchiveIntermediates/.../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework'
I recently updated to the latest version of Xcode (v 10.0). I am also using Cocoapod version 1.6.0.beta.1
Using GoogleMaps pod version 2.7.0, GooglePlaces pod version 2.7.0
When I run 'pod install' it also installs 'GoogleUtilities (5.3.0)'.
I tried deleting my Podlock, Podfile, .xcworkspace, etc and starting over with a new Podfile, pod init, pod install, etc. after updating Cocoapods but still no luck.
I'm looking for a duplicate relating to GoogleUtilities or Places or Maps in Build Phases within Embed Pod Frameworks, but not having much luck. When I look inside the Pods folder, I do see two GoogleUtilities frameworks, "GoogleUtilities-00567490" and "GoogleUtilities-ac14cd06", but both appear not to have the exact same contents.
Only now experiencing this issue after updating Xcode to version 10.0.
For me, the same issue was coming and Most of the people saying to change the build system to legacy, but when I tried its It started swift compilers error. resolved as mentioned below.
Go to your target and click on (your_app_name_target).
Select Build Phases.
Expand Copy Pods Resources.
See the section Output Files.
This section should be empty. Remove any entry there.
Rebuild your Project.
Going to File > Workspace Settings and then changing the Build System from "New Build System (Default)" to "Legacy Build System" will allow you to archive for now. Hopefully, another solution comes along for using those pods and the new build system in Xcode 10.0

Reference to cocoapods when running unit tests

I've created a brand new static library project for iOS in Xcode 5 called 'MyApi'. After that I create a Podfile adding AFNetworking as a dependency so far so good. Lets say that I need to use AFNetworking in my MyApi.h file, #import . Finally I want to run tests on my code. I start by adding #import "MyApi.h" in my MyApiTests.m. If I hit CMD+U to test my code it will complain that the tests can't find AFNetworking. I can solve this by adding link_with "MyApi", "MyApiTests" in my Podfile. But now when I hit Test it will complain about duplicate symbol _OBJC...... (on all AFNetworking classes). I managed to get around this by removing libPods.a in Link Binary With Libraries in the MyApiTests target and everything works fine. But every time I run pod install I will have to do this manual step of removing the libPods.a. Since we don't keep the workspace that cocoa pods creates in our git repo. And since this is running on a jenkins server automatically I can't manually remove the libPods.a file. Can this be done in a better way that works without the manual step?
(Please don't make this a discussion about if you should checkin the xcworkspace).

Resources