Error Build for Testing when run command pod install - ios

I've a problem when I run "Build for Testing" on Xcode.
Step 0: In pod file using pod for target test as image below:
Step 1: Go to terminal and run command pod install.
Step 2: Go back to Xcode and touch tab bar Product -> Build for testing then the project warning error.
I trying to fix it 2 days. Unfortunately, my project still error. I appreciate kind of support me to solve it.

This happens because when you run pod install it changes the build configuration.
go to Project >> Build Settings search for architecture.
then make sure you have the same configuration for build active architectures only in both places
1. your project build configuration
2. pods project build configuration
If they differ your project will not build

Related

ios build error: Multiple commands produce on "flutter run" from command line [duplicate]

Flutter iOS build fails after upgrading to Xcode 10.0 version in mac.
Nagendras-MacBook-Pro:uaenumber nagendra$ flutter run
Launching lib/main.dart on iPhone X in debug mode...
Starting Xcode build...
Xcode build done. 1.4s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
error: Multiple commands produce '/Users/dev/Documents/projects/Personal/uaenumber/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework':
1) Target 'Runner' has copy command from '/Users/dev/Documents/projects/Personal/uaenumber/ios/Flutter/Flutter.framework' to '/Users/dev/Documents/projects/Personal/uaenumber/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework'
2) That command depends on command in Target 'Runner': script phase “[CP] Embed Pods Frameworks”
warning: The use of Swift 3 #objc inference in Swift 4 mode is deprecated. Please address deprecated #objc inference warnings, test your code with “Use of deprecated Swift 3 #objcinference” logging enabled, and then disable inference by changing the "Swift 3 #objc Inference" build setting to "Default" for the "Runner" target. (in target 'Runner')
warning: ignoring duplicated output file: '/Users/nagendra/Documents/projects/Personal/uaedialer/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework' (in target 'Runner')
note: Using new build systemnote: Planning buildnote: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone X.
Xcode Version - 10.0 (10A255)
I tried to recreate the project and copied all the source files to the new project folder but it does not resolve the issue.
This solution worked for me.
Open ios/Runner.xcworkspace Select the Runner project in the project
navigator sidebar.
In the main view, select the Runner target, then select the Build Phases tab.
Expand the Embed Frameworks phase and select Flutter.framework from the
embedded frameworks list.
Click - to remove Flutter.framework from the list (be sure to keep
App.framework).
It's a known issue. Here is the explanation and some workarounds:
https://github.com/flutter/flutter/issues/20685#issuecomment-421511890
Affected projects
This issue affects all Flutter projects built using Xcode 10 that have
a dependency on CocoaPods -- typically this means those that rely on
plugins. Workarounds
There are two workarounds:
Option 1: Use the legacy build system . As noted by #gi097, open ios/Runner.xcworkspace, and change the build system to Legacy Build
System.
Option 2: Use the new Xcode 10 build system.
Open ios/Runner.xcworkspace
Select the Runner project in the project navigator sidebar.
In the main view, select the Runner target, then select the Build Phases tab.
Expand the Embed Frameworks phase and select Flutter.framework from the embedded frameworks list.
Click - to remove Flutter.framework from the list (be sure to keep App.framework).
Root cause
When plugins are in use, there are two competing build actions that
copy Flutter.framework into the build application Frameworks
directory:
The Embed Frameworks build phase for the Runner project
The [CP] Embed Pods Frameworks build phase that pod install creates in the project.
Item (1) is there to ensure the framework is copied into the built app
in the case where there are no plugins (and therefore no CocoaPods
integration in the Xcode project). Item (2) is there because Flutter's
podspec declares Flutter.framework as a vended_framework, and
CocoaPods automatically adds a copy step for each such
vended_framework in the transitive closure of CocoaPods dependencies.
If you have tried everything and still cannot build the Archive successfully, then you look like my case.
It took me 3 business days to fix this. My problem happened after adding the Notification Services target to the project. But it looks like it will apply to many other cases as well:
The problem is caused by the library inside 2 target multiple commands produce. In my case, for example, in the project target and notification extension target, both GoogleUtilities had this causing them to conflict or duplicated the commands produce. The solution is to make that dependency explicit, at the top level.
The pod file will look like this:
platform :ios, '10.0'
use_frameworks!
inhibit_all_warnings!
pod 'GoogleUtilities' // Add this line is very important.
target 'MyProject' do
pod 'Firebase/Analytics'
pod 'Firebase/Crashlytics'
pod 'Firebase/Messaging'
# Other pods
end
target 'NotificationService' do
pod 'Firebase/Messaging'
end
After run:
pod deintegrate
pod install
This issue was fixed by opening the Runner workspace project in Xcode 10. Then navigate to File, Workspace Settings and change the build system to Legacy Build System.
Edit: The latest stable version of Flutter will migrate your Xcode project to the new build system (step one below) and avoid the multiple embedded frameworks warning altogether. If it doesn't, follow the instructions at https://flutter.dev/docs/development/ios-project-migration. You no longer need to edit your Podfile (step two below).
See https://github.com/flutter/flutter/issues/20685#issuecomment-622126064
Previous answer
Open ios/Runner.xcworkspace in Xcode. File > Workspace Settings... > Build System, change dropdown to New Build System (Default)
In your Podfile, add the line
install! 'cocoapods', :disable_input_output_paths => true
3. In your Flutter app, build again to trigger a pod install, which will automatically clean up the build phase
flutter build ios
See:
https://github.com/flutter/flutter/issues/20685#issuecomment-509731873
https://github.com/flutter/flutter/issues/20685#issuecomment-510162863
Warning:
Do not revert to the Xcode deprecated legacy build system to fix this issue as suggested in the other answers.
I faced this problem today and nothing fixed it. Then i check my xcode project and i found that insider runner folder i found another runner show red which was not there before. So i delete that and rerun my project and it fixed my problem.
I try the above method but it didn,t fix my problem. But you can try both to see which one work for you.
Try this:
flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
rm ios/Podfile
flutter run

Xcode 10 Error: Multiple commands produce for 'app' and 'appex'

I got the recently discussed "Xcode 10 Error: Multiple commands produce..." error, but for the resulting app and appex file of my project. Does anyone have an idea what this means. My project has one app and two extensions (only one is part of the error).
Showing Recent Messages
Prepare build
note: Using new build systemnote: Planning buildnote: Constructing build description
Build system information
error: Multiple commands produce '/Users/xxx/Library/Developer/Xcode/DerivedData/MyApp-enqofdpadskdcgemmhrzsxahnjet/Build/Products/Debug-iphoneos/MyApp Dev.app':
1) Target 'MyApp Dev' has create directory command with output '/Users/xxx/Library/Developer/Xcode/DerivedData/MyApp-enqofdpadskdcgemmhrzsxahnjet/Build/Products/Debug-iphoneos/MyApp Dev.app'
2) That command depends on command in Target 'MyApp Dev': script phase “[CP] Copy Pods Resources”
Build system information
error: Multiple commands produce '/Users/xxx/Library/Developer/Xcode/DerivedData/MyApp-enqofdpadskdcgemmhrzsxahnjet/Build/Products/Debug-iphoneos/MyApp Dev Share Extension.appex':
1) Target 'MyApp Dev Share Extension' has create directory command with output '/Users/xxx/Library/Developer/Xcode/DerivedData/MyApp-enqofdpadskdcgemmhrzsxahnjet/Build/Products/Debug-iphoneos/MyApp Dev Share Extension.appex'
2) That command depends on command in Target 'MyApp Dev Share Extension': script phase “[CP] Copy Pods Resources”
Build system information
warning: ignoring duplicated output file: '/Users/xxx/Library/Developer/Xcode/DerivedData/MyApp-enqofdpadskdcgemmhrzsxahnjet/Build/Products/Debug-iphoneos/MyApp Dev.app' (in target 'MyApp Dev')
Build system information
warning: ignoring duplicated output file: '/Users/xxx/Library/Developer/Xcode/DerivedData/MyApp-enqofdpadskdcgemmhrzsxahnjet/Build/Products/Debug-iphoneos/MyApp Dev Share Extension.appex' (in target 'MyApp Dev Share Extension')
Build failed 18.09.18, 10:28 4.5 seconds
I know I can go back to the legacy build system, but I would prefer using the new and faster build system. Thank you for any help.
In case someone is still struggling with this after updating cocoapods and reinstalling pods:
Open Build Phases of the target which gives you problems
Open Copy Pods Resources phase.
Make sure the Output Files is empty. In my case I had a strange entry ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}. I removed it and the build was successful
Solved my problem by updating Cocoapods from 1.4.0 to 1.5.3
I was able to fix it by opening the Runner workspace project in Xcode 10. Then navigate to File, Workspace Settings and change the build system to Legacy Build System.
My Cocoapod version was already 1.5.3(latest).
Just running "pod install" (or "pod install --no-repo-update" if you don't want to update existing pods) solved it for me.
My workaround:
Check your pod version pod --version.
Update Coacoapods to latest version - v1.5.3 if it's not, by running sudo gem install cocoapods
Update all your pods by running pod update
Remove duplicate info.plist file from Target>Build Phases>Copy
Bundle Resources if any.
set "Build System" to "Legacy Build System" in "Shared Workspace Settings" which you can find in "File --> Workspace Settings"
Works form me:
Update Cocoapods
Delete pod file (Don't forgot to copy the contents some where else, so you can restore it)
Delete workspace project file
Delete lock pod file
Delete pod directory
Close the Xcode
Initialise pod
Install pod
Open the workspace project.
One of a possible issues causing the "Multiple commands produce" error may be several targets with conflicting module name. In my case I had a main application target and a notification service extension target with the same Product Module Name, so Xcode was trying to create two ModuleName.swiftmodule files, two ModuleName.swiftdoc files etc. Changing notification service extension module name fixed the problem.
You might have ran into this CocoaPods issue which is caused by this Xcode issue
This reply might help you, it suggest to specify the subspecs explicitly in your Podfile.
For example use pod 'SDWebImage/Core' instead of pod 'SDWebImage'
Apparently, this causes the build product path to always contain the subspec name which might fix the issue.
The key was to do pod deintegrate and rm *.workspace file !
In my case, there was duplicate reference in Copy Bundle Resources of App Target.
I just removed one of them and it worked.
If your error is not gone by updating cocoa pods then simply create new project but change folder location. you will not get this error.
I had a problem like this . . . The solution worked for me was
Go to your Project Target and delete the dupicate reference of your file under the Copy Bundle Resources.
Hope this helps!!!
My problem was rather unique.
I had a unit testing target that had a host application as "Target1"
I had a separate ui testing target that had a host application as "Target2"
I also had Target2 being capable of testing using both my test targets.
The solution was to remove the unit test target from Target2 test (inside edit scheme).
I could also have both my testing targets use the same host application (which I will)
For me, it was a scheme that lost its PRODUCT_NAME after a merge conflict.
To know if this is your problem, you can go to build settings and search for PRODUCT_MODULE_NAME if you see one of your schemes missing it, that's your problem. for me, I fixed it by adding PRODUCT_NAME = <my app's product name like shown under other schemes> to <appName>.xcodeproj/project.pbxproj under the relevant scheme.
But you can probably get it done in Xcode's build settings
I had the same problem with Xcode 10 GM. In my case below solution worked.
Check-in Project -> Build Phases -> Copy Bundle Resources have files with the same name. Just remove the repetitive file

Automatically build cocoa pods for Xcode Workspace

Just wanted to know what is the best way/place to run pod install or pod update so that each time when I build the project in Xcode, the command runs automatically.
I tried with putting pod install in Xcode Project -> Scheme -> Pre-actions, but was not able to see any output. Is there any other better way?

iOS: Cocoa Pods: Code Compile Issue

The Problem
I recently started working on a project.
Which Uses Cocoa Pods as the dependency manager.
It also uses Crashlytics for crash reporting.
Image Magick for Icon generation and Synx for reorganizing the project folder.
I was given Git access.
So I cloned the repo.
did a pod install
and compiled the code but it started giving me following error.
Project target is iOS 7.
Cocoa Pods Version is 0.36.4 also tried Latest 0.38.2
It is an iphone only app.
What I have done So far trying to solve this issue
So I sat down with the Original developer who was very helpful and had a working copy of the code on his machine. As it was a code handover so he was helping me setting it up on my machine.
We have tried all the usual suspects.
Clean and Build
Clean Quit Xcode Reopen and build
Quit xcode delete the Pods Directory and do a pod install
pod setup
pod update
Checked PODS_ROOT paths for different build configurations with working copy on another machine where it compiles correctly
My pods were latest so I uninstalled cocoapods using sudo gem uninstall cocoapods and installed the version the original developer had sudo gem install cocoapods -v 0.36.4
Matching Xcode versions xcode 6.4
Checking Configurations under Info in Project
Another pull from Github at a different location and doing all above steps.
Clear Xcode derived data folder.
So basically we checked all this retried all the above steps many times and also verified project settings build phases etc.
code is running fine on his machine.
Some weird behaviour i noticed was that one time instead of above mentioned error in picture it gave the famouse xyz.h file not found error for one of the libraries in Pods. But doing a pod install reverted back to original error.
Any ideas?
I remember this one.. I think it is due to cocopods changed the directory of there "copy pods resources" shell script from one version to the other. Look under your targets build phases and check for a "run script" entry i think. Look at the path and then check in finder to see where the shell script is really located.
Not really certain of the details... it might have been one of the other cocopods enters in the build phase section. Look around there, I do remember it was pretty easy to spot when you know where to look.
Should probably be the "Check Pods Manifest.lock" section under Build Phases.
Make sure you are opening workspace project(.xcworkspace) instead of XCode Project..
Else
Remove podfile.lock
Remove Pods Folder
Remove .xcworkspace
Remove manifest.lock (if exists)
Go to path of pod file and Run pod install
Then it will generate .xcworkspace.
Now onwards you need to use workspace instead of xcodeproj
Hope it helps you..!

The sandbox is not in sync with the Podfile.lock-ios

I have got the following errors after trying multiple answers from the google.
PhaseScriptExecution Check\ Pods\ Manifest.lock /Users/apple/Library/Developer/Xcode/DerivedData/Build/Intermediates/FoodSpot.build/Debug-
iphonesimulator/FoodSpotTests.build/Script-36819C3C1B6A30F50091382D.sh
cd "/Users/apple/Downloads/FoodSpot 2"
/bin/sh -c /Users/apple/Library/Developer/Xcode/DerivedData/Build/Intermediates/FoodSpot.build/Debug-iphonesimulator/FoodSpotTests.build/Script-36819C3C1B6A30F50091382D.sh
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.
I have updated and installed many times, but they are of no use.
For me, the reason was missign User-Defined variables in the Build Settings!
Looking into the issue, the Build Phases tries to diff 2 files.
diff "${PODS_PODFILE_DIR_PATH}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
Just because of missing PODS_PODFILE_DIR_PATH and PODS_ROOT variables, assumes them as "" so ${PODS_PODFILE_DIR_PATH}/Podfile.lock points to /Podfile.lock and same for the other one.
So it fails in
diff /Podfile.lock and /Manifest.lock
I fixed this by adding 2 User-Defined settings to the Build Settings
PODS_ROOT = ${SRCROOT}/Pods
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
After hours of searching this is the only solution that worked for me
For me, it works after the following:
pod deintegrate --verbose
pod install --verbose
Run 'pod install' or update your CocoaPods installation.
You have answer in the error itself !
The error message states that you should update your CocoaPods installation.
You could remove libPods in frameworks and libraries and update Cocoapods using pod install.
Also:
clean and build the project
SO references :
CocoaPods Errors on Project Build
Error:"The sandbox is not in sync with the Podfile.lock..." after installing RestKit with cocoapods
I had been searching for hours and I found solutions as follow:
In my case, method 3 works.
Method 1:
choose the target > go to Build Phrases > click Link Binary With Libraries > remove all libPods.a files
open Terminal > direct to your project > run:
pod install
clean and build project
ref.1
Method 2:
open Terminal > direct to your project > run:
pod deintegrate --verbose
pod install --verbose
ref.2
Method 3:
choose the target > go to Build Settings > click "+" sign
add 2 User-Defined Settings: [to the left = to the right]
PODS_ROOT = ${SRCROOT}/Pods
and
PODS_PODFILE_DIR_PATH = ${SRCROOT}/
ref.3
Just go to Build phases and click on [CP]check Pods Manifest.lock.
diff "${PODS_PODFILE_DIR_PATH}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
Both PODS_PODFILE_DIR_PATH and POD_ROOT should define in user-Defined in build settings.
POD_ROOT should have correct path to Manifext.lock file and
POD_PODFILE_DIR_PATH should have correct path for Podfile.lock
So Add below in build settings.
PODS_ROOT ---- ${SRCROOT}/Pods
PODS_PODFILE_DIR_PATH ---- ${SRCROOT}
The problem is Podfile.lock and Manifest.lock cannot be found by the Check Pods Manifest.lock Script in your targets build phase.
This is usually caused by PODS_PODFILE_DIR_PATH and PODS_ROOT variables not being defined.
Go to build settings tab to define them.
You will need to look for Podfile.lock and Manifest.lock in your project and get the the full paths of their directories. The directory paths will be the values you use for PODS_PODFILE_DIR_PATH and PODS_ROOT.
Deleting the derived data did the trick for me . I deleted by going into the finder itself.
Make changes in the podfile as given below:
Older pod file
target :TargetName, :exclusive => true do
Changed pod file
target 'TargetName' do
I'm pretty sure that you have opened your Projects' workspace which you try to install new Pods. So try out the following (for me this worked):
Clean the project
Close the project
Run pod install
Open the project and try re-building it once more
Problem might have been resolved.
Edit
It turned out my issue was due to a new line at the end of the Manifest.lock that was not present in the PodFile.lock file. Running a diff on the two files highlighted the issue.
Adding a new line to the end of the PodFile.lock file solved it.
Original Answer
None of the answers have worked for me so I have just checked the "For install builds only" under "[CP] Check Pods Manifest. lock" which is found in the build phases tab.
I believe this setting means it will only run that check when archiving, allowing me to continue developing as I don't need to archive the app on my machine.
Use with caution though as it may not be the best solution for everyone.
This happens if cocoa pods don't install or uninstall properly
If you want to install cocoa pods run
pod install
if you you want to uninstall cocoa pods then run command
pod deintegrate
I had the same issue. Turned out the cocoapods version on Manifest.lock was higher than what I had on my mac. I had to do a 'sudo gem install cocoapods', to get the version of the cocoapods upto what was specified on the Manifest.lock file. This fixed the issue and I had no errors on building the project.
Im facing the same issue now and fixed using this command after navigating to project location in terminal.
pod install --repo-update
I fixed this by adding 2 User-Defined settings to the Build Settings
PODS_ROOT = ${SRCROOT}/Pods
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
In my case, I got same error after integrating my other targets. To solve problem I needed to add both targets in Podfile:
abstract_target 'myApp' do
use_frameworks!
pod 'Alamofire', '~> 3.0'
pod 'SwiftyJSON'
target 'myAppOtherTarget'
end
Make sure you add a "pod install" command line build step, before the Xcode Project build step.
The error is coming from the build phase run script in your Xcode project's target, which is unable to find Podfile.lock. This file is generated by CocoaPods, which must be installed in a build step in your TeamCity project.
My build steps look like:
Command line: bundle install --path .bundle (installs cocoapods local to the project using Gemfile).
Command line: bundle exec pod install --verbose (uses Podfile)
Command line: carthage update --platform iOS (uses Cartfile)
Xcode Project
Command line to build an archive
Command line to upload a build
Hope this helps.
In my case, the errors were occurring on a _Tests target. I didn't need the _Tests target, and so I deleted it. This resolved the error.
If you happen to move your Podfile like i did and face this issue, the solution discussed below may help -
Delete all of the following - Pods folder, xcworkspace
file, podlock file (skip the ones that are not available for subfolders)
delete all steps that has [cp] in it from the build phase tab
repeat step 1 & 2 for all the sub projects that you have in your workspace
open workspace, go into each project and delete framework for pods, and delete the pods folder from each project
close workspace
run pod install
you should now be able to open, build and run the project
I just fixed it by updating the Cocoapod, cause before the error there was log where the warning shows we need to upgrade our cocoapods as the pod files are not supported by the current cocoapod version, So clean the project , upgrade cocoapod then install pod.
1. Clean project
2. sudo gem install cocoapods/gem install cocoapods
3. pod install (optional if your project still shows error)
Note: I found this error for my flutter application in iOS platform
I think you are trying to use your old project pod folder in your current project, you have to copy Manifest.lock file of your current project and replace that file in your old project's pod folder which you added. Manifest.lock file location YourProject->Pods->Manifest.lock
Hope This was helpful. worked for me!
Please check Top Sites - Sandbox Sync iOS for more explanation. I fixed the issue by changing file paths from
diff "${PODS_PODFILE_DIR_PATH}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
to
diff "${SRCROOT}/Podfile.lock" "${SRCROOT}/Pods/Manifest.lock" > /dev/null
in Xocde -> "Open Your Project" -> "Select Your Project" -> "Select Your Target" -> Build Phases -> Check Pods Manifest.lock
If not, try changing paths as mentioned above, along with Legacy Build System. To change build system Xcode -> File -> Workspace Settings -> Build System -> Legacy Build System
I hate to say this, but I just removed the pods/ or didn't include them in the project and it built. I don't know if this will have a long-term effect on the project though.
This is presently my .sh build script for ionic5 for ios. It will probably change in the future.
# BUILDING FOR IOS
##################################
#
# MAKE SURE YOU UNPLUG ALL DEVICES!!!!!
#
##################################
ionic cordova platform remove ios
ionic cordova prepare ios
ionic cordova platform add ios
ionic cordova build ios --prod --release --buildFlag="-UseModernBuildSystem=0" --verbose
cd platforms
cd ios
open "MyApp.xcworkspace/"
cd ..
cd ..
It had be plaguing my project, so I thought I'd take them out. I am yet to deploy the project so far though... so who knows.
BigSur 11.1, XCode 12.4 (12D4e)

Resources