xcodebuild fails with error=nsconsumed-mismatch when using Xcode11 iOS13 SDK - ios

I use the following command to build/archive my project:
xcodebuild -UseNewBuildSystem=NO -workspace WORKSPACE -scheme TARGET clean archive
The compilation fails with the following error:
error: -Werror=nsconsumed-mismatch is currently enabled, but was not in the PCH file
The same build command works when building against Xcode 10.2/10.3 and iOS 12 sdk.

Related

Can't build or archive app using xcodebuild "...-frameworks.sh: line 42: source: unbound variable"

I am unable to build our app using the xcodebuild command, however if I open the project in xcode and click build or archive from the Product menu, it builds absolutely fine. I can't work out what I am doing differently via cli that is causing it to error.
The command I am using:
xcodebuild archive -scheme Dropless -configuration Release -destination 'generic/platform=iOS' SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES
The error:
/ios/Pods/Target Support Files/Pods-Dropless/Pods-Dropless-frameworks.sh: line 42: source: unbound variable Command PhaseScriptExecution failed with a nonzero exit code
I have seen various posts online about this error and all seem to point toward the same thing with the defined architectures, however nothing I do seems to make a difference and if it builds in xcode manually I can't see there being an issue with what I've defined.
This is my settings:
xcode version: 13.4.1
osx version: 12.5.1 Monterey

Fresh React Native Project Fails on IOS build (M1 MacBook)

I created my first react-native project and I started metro just fine. But When I try to run IOS it fails to build. Any suggestions on what I should check?
latest Xcode installed
karar#Karars-MacBook-Air TheGlobalDoctor % npx react-native run-ios
info Found Xcode workspace "TheGlobalDoctor.xcworkspace"
info Building (using "xcodebuild -workspace TheGlobalDoctor.xcworkspace -configuration Debug -scheme TheGlobalDoctor -destination id=845FA08B-2299-4B05-B9C9-207405392A77")
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening TheGlobalDoctor.xcworkspace.
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace TheGlobalDoctor.xcworkspace -configuration Debug -scheme TheGlobalDoctor -destination id=845FA08B-2299-4B05-B9C9-207405392A77
Xcode Failed Build error:
fatal error: module map file '/Users/karar/Library/Developer/Xcode/DerivedData/TheGlobalDoctor-axdadhlgtbbtzcabxyzzteupuwlt/Build/Products/Debug-iphonesimulator/YogaKit/YogaKit.modulemap' not found 1 error generated.
I had a similar issue. You can start XCode using Rosetta to circumvent the problem for now.
To do so open 'Applications' and find XCode. Open it's context menu and select 'Get Info'. In the info view, make sure the "Open using Rosetta" checkbox is checked.
(Thx to Karthik posting the solution in his blog)

fatal error: 'XCTest/XCTest.h' file not found

I am trying to build a swift ios app via the command line for integration tests and I am getting the error in the title. This is a command im running in ci: xcodebuild -workspace project.xcworkspace -scheme project -configuration Release -sdk iphonesimulator12.4 -derivedDataPath ./build clean build so I need to have a fix that uses the command line or can be committed in the project so that it builds every time.

How to fix Carthage Build Error: "SWIFT_VERSION '3.0' is unsupported" when Swift 5 is selected

I am migrating a "NetworkFoundation" Framework, which is based on Alamofire, to Swift 5. Carthage is being used as the dependency manager,
The cartfile looks the following:
github "Alamofire/Alamofire" "5.0.0-beta.5"
The command carthage update is executed with success. In Xcode the project builds, but when I run the command carthage build --no-skip-current in the root directory of my framework it fails:
xcodebuild output can be found in /var/folders/1m/qjb4gks13d54rqmn9ptwjmmw0000gp/T/carthage-xcodebuild.bg5VCR.log
Building scheme "Alamofire macOS" in Alamofire.xcworkspace
Building scheme "Alamofire tvOS" in Alamofire.xcworkspace
Building scheme "Alamofire watchOS" in Alamofire.xcworkspace
Building scheme "Alamofire iOS" in Alamofire.xcworkspace
Building scheme "MyNetworkFoundation" in MyNetworkFoundation.xcodeproj
Building scheme "Alamofire iOS" in Alamofire.xcworkspace
Build Failed
Task failed with exit code 65:
/usr/bin/xcrun xcodebuild -workspace /Users/MyUser/Documents/Projects/MyNetworkFoundation/MyNetworkFoundation/Carthage/Checkouts/Alamofire/Alamofire.xcworkspace -scheme Alamofire\ iOS -configuration Release -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/1m/qjb4gks13d54rqmn9ptwjmmw0000gp/T/MyNetworkFoundation SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/MyUser/Documents/Projects/MyNetworkFoundation)
This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/1m/qjb4gks13d54rqmn9ptwjmmw0000gp/T/carthage-xcodebuild.bg5VCR.log
As recommended, I checked the logfile of the failed build. In there it says:
error: SWIFT_VERSION '3.0' is unsupported, supported versions are: 4.0, 4.2, 5.0. (in target 'Alamofire iOS') ** ARCHIVE FAILED **
So I checked the Swift Version of my Project which seems to be correct.
Because the logfile states that the Swift Version 3.0 is used in target 'Alamofire iOS', I checked the targets in
/MyNetworkFoundation/Carthage/Checkouts/Alamofire/Alamofire.xcodeproj
but all of them have Swift Version 5.
I have no idea what why that error is appearing when I want to build my project. I even tried re-installing Xcode but that did not work either. Anybody got an idea what I am missing?
Xcode Version: 10.2.1 (10E1001)
MacOS Version: 10.14.5 (18F132)
Not sure if this will solve the issue for you but I was experiencing something similar. For me, since I just copied the repo of a project I was onboarding to, I was running carthage bootstrap and it always failed for Alamofire with Swift 3 errors like yours.
My Cartfile file has github "Alamofire/Alamofire" ~> 4.7.2, and my project is using Swift 4.2 (so again, not exactly the same as your setup).
I finally got it to work running the following command:
carthage bootstrap --platform iOS --no-use-binaries --toolchain com.apple.dt.toolchain.Swift_4_2
I believe the trick was to specify the toolchain use Swift 4.2, so I would suggest you try with Swift_5_0. Hope this helps!

Archive failed from shell Command line - LD error

Archive failed using shell command but gets successfully archived using Xcode. I'm using xcode 7.3 with cocoapods version 1.0.0, everything was working fine with same Xcode version but with CocoaPods 0.0.32 version.This issue is only for command line. It works fine for Xcode.
Command using for archiving(Internally this command is being used for archiving in Jenkins)
/usr/bin/xcodebuild archive -archivePath ./build/CloudMessage -scheme LTDMessaging -workspace CloudMessage.xcworkspace -sdk iphoneos -configuration Release CONFIGURATION_BUILD_DIR=./build 'CODE_SIGN_IDENTITY=iPhone Distribution: Leadership Team Dev, Inc' PROVISIONING_PROFILE=1d733147-864f-412e-8877-bcccc636ca27
Here is the error i got
Ld /Users/confiz/Library/Developer/Xcode/DerivedData/CloudMessage-afevkkqtjcnmoddycvosdhbgoraa/Build/Intermediates/ArchiveIntermediates/LTDMessaging/IntermediateBuildFilesPath/CloudMessage.build/Release-iphoneos/LTDMessaging.build/Objects-normal/armv7/LTD\ Messaging normal armv7
Anyone know how to get rid of this issue?

Resources