Xcode 13 error: input file [...] was modified during the build
I'm debugging a similar issue in R.swift, I think I've found the cause of the issue.
Xcode 13 appears to execute Run Script build phases during index builds. This can cause a file to be written to by an index pass, in parallel with a build.
To check if this is happening for you, add this to your build script: say $ACTION
On Xcode 12, it only says "build", but in Xcode 13 I hear it saying "indexbuild" during compilation, whenever I save .swift files or otherwise navigate through my code.
To prevent your script from running during indexing, add this check:
if [ $ACTION != "indexbuild" ]; then
# your script here
fi
Command CompileSwift failed with a nonzero exit code in Xcode 10
Currently my build is working.
Here you are the steps I tried until it finally worked:
- Search in the whole project the word CommonCrypto.
- If you have a Pod containing that header import, remove this Pod from the Podfile and perform a pod install.
- Clean and build the project.
- Add again the Pod to the Podfile and perform a pod install.
- Clean and build the project again using a real device if possible.
And If you don't have that Pod, maybe you can try by making the same steps with some old Pod that you may encounter in your project.
Added information: also If you have some code error inside a Pod, first you need to solve that code problem and then try to compile again the project.
I'm going to copy the changes made in my project.pbxproj. I know it's not very helpful but it's the only thing that have changed in the git difference commit:
Removed: BDC9821B1E9BD1B600ADE0EF /* (null) in Sources */ = {isa = PBXBuildFile; };
Added: BDC9821B1E9BD1B600ADE0EF /* BuildFile in Sources */ = {isa = PBXBuildFile; };
I hope this can help,
Regards.
Xcode 10 (10A255) Error: unknown:0: error: duplicate input file
Your project folder contains directories with space in name e.g. "Hello World".
You should rename all founded directories (even without source code) into name without spaces, e.g. "HelloWorld" or "Hello-World".
<unknown>:0: error: duplicate input file 'Tests.build'
<unknown>:0: error: duplicate input file 'Extension.build'
<unknown>:0: error: duplicate input file 'Home'
'Tests.build', 'Extension.build', 'Home' are part of name after space.
So, with this hack you can solve all errors, except last issue:
"<unknown>:0: error: if any output files are specified, they all must be"
But anyway, I didn't a find solution for last error.
UPDATE:
Last error fixed by removing spaces in Product Name in Build Settings for your target (don't confuse with Display Name in Info.plist, it can contain spaces)
Xcode/Swift 'filename used twice' build error
Try to search, if you have added same ViewController - MainController.swift
twice.
If not, then search class MainController
in codebase.
Regarding Pods, it is preferred to use all Pods as frameworks,
So try using 'use_frameworks!'
in your Podfile
, and then from terminal reinstall the pods "pod install
".
Build input file cannot be found' Swift 4.2, Xcode 10.0
Moving the folders around the inspector can cause the error "Build input file cannot be found"
SWIFT 5
In Swift 5, the error came up but the identity showed no errors.
- Go under build settings and select packaging.
- Delete the current paths for Debug and Release and enter your new path where the info.plist is kept.
For example [APPROJECTNAME]/[THEINFOPLISTFOLDER]/info.plist
In the screenshot below, the path is API-client/Resources/info.plist
SWIFT 4
To fix it, go to the general tab and under identity reselect the info.plist that you like
I hope this helps
Swift Compiler errors
for service: HMService in detailItem!.services
{
if !services.containsObject(service)
{
println(service)
services.addObject(service)
tableView!.insertRowsAtIndexPaths([NSIndexPath(forRow: 0, inSection: 0)], withRowAnimation: UITableViewRowAnimation.Fade)
}
}
this is the code that was crashing for me and all i did was remove the HMService and then it worked. i didnt want to use the properties of HMservice but i could do without it.
so i just did something like this.
for service in detailItem!.services
{
if !services.containsObject(service)
{
println(service)
services.addObject(service)
tableView!.insertRowsAtIndexPaths([NSIndexPath(forRow: 0, inSection: 0)], withRowAnimation: UITableViewRowAnimation.Fade)
}
}
Hope this helps people
swift failed with exit code 1 while compiling in Xcode - possibly related to Bridging-Headers
I did the same all answer says but mine issue was not resolved. I did figured out that issue was related to broken function call.
A function syntax was not wrong but its calling mechanism was wrong.
To check the exact error for this issue check following:
Select issue navigator > Click on error will show logs for error > In that select All Messages tab.
This will show all detail logs for this error.
Scroll down and You got logs like, in my case
So, by reading this I figure out that something wrong with function calling. I browse my code and resolved it, Below was correct and wrong code.
Wrong Way:
var region = MKCoordinateRegionMake(self.mapView.userLocation.coordinate, span)
// It will not shown error here but when you build project compiler shows error.
Right Way:
let region = MKCoordinateRegion(center: self.mapView.userLocation.coordinate, span: span)
Related Topics
Swift Enumeration Order and Comparison
Swiftui, Shadow Only for Container
Iterating Over an Nsorderedset
Gmsplace Returns Invalid Coordinate (-180, -180), But Name and Place Id Are Correct
Captureoutput Function Isn't Called Using Setsamplebufferdelegate
How to Access Cfdictionary in Swift 3
"Use Default Container" Doesn't Show in Icloud Capabilities
Swift "Is" Operator with Type Stored in Variable
Swift Find Superview of Given Class with Generics
Adding a Custom Font to MACos App Using Swift
Saving Exif Data to Jpeg - Swift
Xcode Swift. How to Programmatically Select Cell in View-Based Nstableview
How to Make a Button Draggable/Movable with Swiftui