extension SlideInAnimator: UIViewControllerAnimatedTransitioning {
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
// This works
UIView.animate(withDuration: 0.3, animations: { }) { transitionContext.completeTransition($0) }
// transitionContext.completeTransition causes the error
UIView.animate(withDuration: 0.3, animations: { }, completion: transitionContext.completeTransition)
}
}
Xcode isn't showing any errors but while compiling, it causes the error shown in the title (even after cleaning). Whenever I comment out the second animation, the error won't show up. Is this a bug or I'm just not allowed to use it like the second animation?
The swiftc failed with exit code 1 message indicates that the compiler crashed due to an internal problem. In my experience, that may or may not indicate that there's some type of syntax error with your code (although what you posted looks fine to me), but either way, the compiler can't handle it as you have it written.
The Swift toolchain is still very buggy unfortunately, and sometimes you have to "help it out" by trying a different syntax for whatever you're doing.
You may want to check https://bugs.swift.org and see if there's a bug already reported for it, and add one if not.
Simple Solution For This With xcode 8.2 and swift 3.0
Click top left of the project navigator (your project name ) and clean project with (cmd+shft+k).
Quite Xcode completely from tray too.
Open project again.
wait and let xcode done indexing of files.
Run project and thats it.
Enjoy Happy Coding!!!
I've just spent a couple of hours trying to identify the cause of a swiftc exit code 1.
After reading several posts, cleaning the project & restarting xcode several times, commenting out new chunks of code etc., I gave up and started to create a fresh project.
When I copied the first .swift file from old to new project I noticed that I had two .swift files with the same name in different folders. I tidied up my files and the project compiled OK.
In summary, as has been stated in other posts, Exit code 1 seems to be a catchall for when the compiler finds something weird & unexpected that it doesn't handle properly.
Related
During a marathon session yesterday (from 7 am until past midnight), I suddenly ran into an issue where, immediately after launching the app in the simulator, button taps with prints to the console and swipes on views wouldn't result in any change for about 15 seconds. Eventually (10 - 15 seconds) the console output appears, the views swipe and it seems normal again.
I am using Xcode version 12.5 (12E262) on Big Sur 11.2.3
I have looked at these, and countless others:
iPhone Simulator suddenly started running very slow
Xcode freezes on startup while loading project
I removed the project's folder from Derived Data, I confirmed "Slow Animations" is not checked. I did not remove "xcuserdata" folder. I just don't know where to turn to debug this issue. Has anyone seen this behavior? Did I stutter and hit a key combination (Triple tap on Shift and CMD-T both used to toggle slow animations I've learned)? I feel like I've added code that is triggering this, but I can't be sure. I had spent the entire day refactoring my project to reduce the Objective-C and UIKit code and make better use of Composable Architecture (TCA). If people suggest debug steps I could perform I'll try them out and report back. I just don't know how to continue debugging this issue.
Backups from before the day's changes do not exhibit this behavior. I copied the project to a new directory and replaced all source code with the backed up source code. And that works fine. So I can lose the work from 3 pm to midnight last night or suffer through this until I have disk space to install 12.5.1
Any insights would be most welcome
So I ran a timer profile -- see this awesome article:
https://www.avanderlee.com/debugging/xcode-instruments-time-profiler/
I came up with this:
Which led to this:
And I understood where I introduced the problem:
var selectedNibIndex: Int = 0 {
didSet {
brush = WDBrush.from(index: selectedNibIndex)!
cameoImage = BrushStrokeImageView(paintBrush: brush)
dictionary = brush.wdPropertiesDictionary() as! [String: WDProperty]
}
}
this is new code, and it is placed inside a struct which is constantly being rebuilt.
I will move it out of there.
**
I guess the answer to my question is to run the app under the time
profiler and let it tell you where the problem is.
**
And marathon sessions aren't always a good idea. I would have caught the problem sooner if I hadn't bitten off such a big task. There was a two hour period where it wouldn't compile and I shouldn't have let that happen. By the time I got it to compile after some changes I had changed so many things I could no longer see the forest for the trees.
I hope this can help others, thanks for reading!
I'm running 10.10 with Xcode 6.1.
And I'm having trouble getting an app I wrote to work. After hours and hours I finally got it to build correctly after accidentally messing with something, but now I'm getting an error I don't have permission to view the file (if I open directly in Xcode) or if I try to open it from the Finder it says the App is damaged or corrupt and can't be open. If it matters it's written in Swift.
I've literally spent 6 hours on this (Just trying to get it to build) so any help would be greatly appreciated! Austen
Here's the Xcode workspace, project, files, and a build if anyone needs to take a look: http://pattersoncode.ca/ServerChecker.zip
There are a several issues here. I can't help you with all of them, but I can put you on the right path, at least.
The app won't launch because it wasn't built correctly. Specifically, there's not any actual binary executable in the built .app. You can see this by right-clicking on the built Server Checker.app and choosing Show Package Contents. In there is a Contents folder; open that. Inside that should be a folder called MacOS, in which your actual binary executable would be. But it's not there. This isn't really an app at all.
Reason is, you have a custom build rule for swift files that's making them not compile at all. Just remove that, you don't need it.
In Xcode, click on the top-level item of the project (it says something like ServerChecker, 1 target, OS X SDK 10.10). Then, under TARGETS, select ServerChecker. Click Build Rules. The thing that says "Swift source files using Script", that we don't need. Click the little X in the top-right corner, and click Delete when prompted. Now try to build again.
You'll get an error:
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
Since you don't have a main.swift file, your app doesn't have a main entry point. In Swift, you must either provide an NSApplicationMain function (usually in main.swift), or you can declare your app delegate as NSApplicationMain, which has the effect of calling NSApplicationMain with your delegate class. I recommend the latter.
Open up AppDelegate.swift, and add #NSApplicationMain to your AppDelegate class. It should look like:
#NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
...
}
Now your app should build again. Right-click it and Show Package Contents to verify that there's actually an executable binary in there.
The app still won't run. It looks like on launch there's an error that a library couldn't be loaded.
Hopefully that helps you get moving, anyway. I really need to get back to work now. :)
I was playing around with the Playground feature of Xcode 6's first beta - and I notice half the time the Playground doesn't update (simply doesn't display the result calculation or how many loop iterations are happening) simple code/loops/functions that are in there. Even the Swift Tour https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/GuidedTour.html
has several lines of code that don't show up in Playground. If you mess with the code sometimes it will show up, by moving the code around or placing it elsewhere. Anyone else? Any fixes? Is this just a beta problem?
Make sure you haven't inadvertently added an error to your Playground code. Unfortunately, there is no inline notification of an error, and after an error is created, nothing in the Playground will update.
To help with this, open up the Assistant Editor (File > View > Assistant Editor > Show Assistant Editor), which should include a Console Output box. If there are any errors in your Playground, they will show up there. Once corrected, your Playground should hopefully update once more.
That said, it can be a bit slow depending on the complexity of your Playground and its size.
This answer (Undeclared Type 'NSView' in Playground) did it for me (restarting Xcode and the machine didn't help):
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
Had the same strange errors after upgrading to xcode 6 beta 6. For me the problem got fixed with a Product -> Clean. And if that does not fix the errors hold down option key and click again on Product in the Menubar then you will see in the dropdown menu Clean Build Folder... click on that. Or you could download Watchdog app from appstore. This little helper automatically cleans your xcode projects.
You have to be very careful with swift. the language is very case sensitive so while using playground make sure all things are spaced out.
The following code will NOT give you a syntax error but it will stop processing the rest of your code in playground :
for index in 1...5 {
if index %2 !=0{
continue
}
println(index)
}
The error in the code above is in line 2. The code has to be written
for index in 1...5 {
if index % 2 != 0 {
continue
}
println(index)
}
Hope that answers your question :)
I've suddenly got a very weird error in Xcode 4.1 that seems to have occurred after Xcode crashed.
I have some Model classes that inherit from a simple base class. Nothing unusual there.
What's happening now is that when I attempt to build for the "device" for one of these model classes that inherit (and only one) it throws a bunch of compile errors saying blah blah undeclared etc. Now if I switch it back to the simulator it builds and runs fine.
This was working perfectly well before the crash. I've done all of the usual clean build, delete derived data, restart XCode etc but still I can't make it work.
If I explicitly add the various bits from the base class into this problematic class it all works fine again.
I'm really perplexed. Any suggestions?
Thanks in advance,
Matt
You should try a "Product->Clean" and then recompile.
Sometimes Xcode doesn't seem to recognize changes made to files and gives weird errors and warnings.
Hope this helps.
If MrHus' clean doesn't work, Control-Click on your .xcodeproj and select Show Package Contents (Xcode projects are bundles). Remove everything but the project.pbxproj files; they may be corrupt.
If that doesn't work, try creating a whole new project from scratch. If that works, then your project.pbxproj was corrupt.
I sometimes see that change I made shows up on third or 4th build run. It's as if xcode "cache" old compilation.
How to delete all compiled file and start from scratch
One thing that's particularly frustating is this:
I got a compile warning
for this code:
[self.currentBusiness addCategoriesObject:self.currentCategory];
I know what the problem. The automatically generated core data code do not have
- (void)addDistrictsObject:(District *)value;
- (void)addCategoriesObject:(Category *)value;
on Business.h. The function is defined in Business.m though.
So I added those 2 lines. Guess what, still the same warning. I had this exact same problem several time with no issue. I know the solution. I put the line right there in business.h. Nothing changes.
Yet now I get the same compiler warning even though the method is CLEARLY defined in business.h.
As if xcode do not care about the last change I put.
I am so frustated. I added #import "Business.h" again in my utilities.h. Shouldn't change anything given that "Business.h" is already included through other channel. Guess what, it works.
But then I thought, ah that's the problem. I curiously remove that //#import "Business.h" again so it's back like usual. If that's really the issue then the error should show up again right? Wrong.
The error is gone.
So changes I made do not show results right away. Either the compiler or the precompiler must use some sort of cache.
This is important. There are bugs that are introduced 2-3 builds before that I don't know how to debug. If code changes right after the first build after I make that change I know that something is wrong.
Also that autorestore doesn't seem to work. I create a snapshot, restore the snapshot into another directory and get lots of compile error.
NO, It only compile the file in which any kind of any editing took place.
Xcode does incremental builds. You can do a clean build by going to the Product menu item and select Clean (or press Shift+Cmd+K). That will delete all intermediate files and start from scratch.
Click xcode -> Empty Caches.
Here is a screenshot.