Why Xcode GM candidate 2 keeps crashing when debugging swift code? - ios

I am little concerned in here, I have been developing an app in Swift and I have gone through all the Xcode betas doing my best without the debugger, using println() like every two lines. All this hoping that soon enough some update will bring back my precious LLDB. But No. I am right now on Xcode GM candidate 2 and I am getting this:
If I hit an exception in the app I am developing, I can't do anything else. If I try a po or go through the stack trace Xcode just crashes.
Breakpoints randomly work, but most of the time it is a Xcode crash.
Am I doing something wrong?
Is there a setting I am a missing?

In my case on Xcode 6.1.1
I changed 'Debug Information Level' from 'Compiler default' to 'Line tables only'.
It's in
Build Settings -> Apple LLVM 6.0 - Code Generation
section

Related

App is NOT Crashing While Debugging

I am facing a strange issue in my currently working app. App is crashing when we install app through diawi or directly install using .ipa . But I am not able to regenerate the issue through debugging. I am totally confused and how can I solve the issue?
I am using Xcode 8.2.1
You can try building the app in Xcode in the Release configuration instead of the Debug configuration.
You do this by
clicking on your app name at the top left (near where you press to run the app)
choosing 'Edit Scheme' from the drop down
clicking on the disclosure indicator by 'Run'
choosing 'Run' from the three choices which appear
there is a drop down called 'Build Configuration'. This will almost certainly be set to Debug. Set this to Release.
Now when you run your app you will be building a far more optimised version - this is the version you build when you are submitting to Apple. It's just the same app optimised for speed/memory instead of debugability.
Hopefully, you should be able to reproduce your crash in Xcode now. However, you'll notice that you get far less debugging information when you hit your crash - this is because Debug builds have lots of extra information in (and are much less optimised by the compiler) specifically to make debugging easier. Being able to reproduce the crash in Xcode should give you a few more clues as to what's going on. At the least you should be able to see the chunk of code causing you issues.
Let us know how you get on.
Use crash tracking tool to track crash here is the detail about installing crashlytics

After Xcode 7.2 beta, project not working on 7.1

After using Xcode 7.2 beta, I turned back to my project in Xcode 7.1, and the app crashes on startup, I get this:
If i comment this line, I get a random error somewhere else. The app was working perfectly, I am sorry there isn't much to explain, but I really dont know whats causing this error.
I tried deleting Derived data and still the problem persists.
It seems like you have a breakpoint causing you some troubles.
Type "br del" in the console (lldb), type "Y" and enter to delete all breakpoints.

Xcode 6 Getting crashed while opening story board which uses Popover Segue

My xcode is recently updated to 6.0.1. In my application i used a popover segue actually for a test purpose. After that the xcode is getting crash continuously. I have re-installed xcode again but no result. Getting crashed again after it opened. Please give me solution to overcome this..
I restored Xcode using the command
defaults delete com.apple.dt.Xcode
in the Terminal.app
That solved the issue for me.
This might be useful: https://stackoverflow.com/a/26110269/546719
Xcode keeps some UI state in that folder and that seems to be creating some inconsistencies that lead to crashes and/or infinite loops.

ios 7 xcode 5.01 app doesnt start after validate components

I got a warning in Xcode 5.01 indicating that I needed to validate components. I clicked the button to do the validation and since then my app doesn't actually start on the simulator. I know I'm being vague but I do recall a message about validating components.
Xcode says the app is running on the simulator but I don't see my app ever appearing on the simulator any more.
I've cleaned the app and reset the simulator. I put a breakpoint in main.m but it never executes. And the breakpoint buttons to step into, over, etc are not highlighted so it is as if it has not reached the main.m breakpoint.
I also don't see any messages in the debug console.
Any idea what happened and what I can do?
Thanks
Ok, the problem was that the app had added arm64 when it did a Validate Project. However, I had an API, that I think only supports 32-bit. So I followed the instructions here which resolved the problem.

Crash on device using ad-hoc distribution

Suddenly my ad-hoc distributions through Testflight and iTunes-sync no longer work. The application distributed using the ad-hoc build config never start fully on device. It crashes immediately with a segmentation fault 11.
The weird thing with this problem is that a debug build, on all the devices mentioned below, work flawlessly. This is causing me to believe that there is something messed up in my project.pbxproj. But when I look in the git-log I see nothing out of order, the only thing changed in there are the Architectures (ARCHS) and Valid Architectures (VALID_ARCHS).
Am I correct to assume that messing up the architectures should not cause an actual error on startup but during the build process?
Some Background:
Also worth mentioning is that I had both Xcode 4.4.1 and 4.5 GM installed, when I upgraded the GM to the one from App Store it removed my backup of Xcode 4.4.1 as well. After that hiccup I removed all version of Xcode, rebooted and installed version 4.4.1 again (this is so I can build for armv6).
Any helpful tips in how to proceed with this debugging is extremely valuable to me.
Thanks for your time.
<3
Console print and crash log from device:
- https://gist.github.com/3781018
I can add more logs if needed.
Current Environment:
- Xcode Version 4.4.1 (4F1003)
- Mac OS Version 10.8.2
Project Setup (pbxproj):
- https://gist.github.com/3780985
Devices tested:
- iPhone 3GS iOS 6
- iPhone 3G iOS 4.2.1
- iPad 2nd Gen iOS 5.1.1
- iPhone 4S iOS 5.1.1
- iPhone 4 iOS 6.0
- iPhone 4S iOS 6.0
Update
To proceed with the debugging this is what I tried:
1. Skip Testflight and use the old-school way of releasing an ad-hoc with iTunes. FAIL
2. Reinstalling the provisioning profiles FAIL
2. Create a new user on my machine an reinstall Xcode. FAIL
3. Build from another machine. FAIL
4. Set optimization level to: -O0 FAIL
Even though I was certain that none of the code had been changed, I saw no other reasonable explanation for this. So I started reverting the project in git, staring with the day I successfully made an ad-hoc release. To my horror I noticed that the same segmentation fault was following me through the fabric of time!
Considering this fact there was only one action left to take; a very powerful way of debugging I dubbed spray-and-pray. =) In other words I started to comment out sections of the code and see if that made any difference and to my complete surprise it actually did. After a few hours of disabling and enabling parts of my application I found the culprit: a static NSArray was never retained. What's really blowing my mind here is that the actual initialization of the array has been looking the same since 2010. So why on earth did this suddenly result in a memory error now? And why did the static analyzer not warn we about this?
I am too exhausted at the moment to answer those questions right now, I will try to update the question with more details and hopefully an answer as well tomorrow.
Once again, a big thank you for anyone who helped out so far! <3
It looks like the cause of the problem is the concurrency issue:
Crashed Thread: 1
In such a case it may be hard to find and resolve the root of the problem (http://en.wikipedia.org/wiki/Unusual_software_bug#Heisenbug).
May be you are doing something with one object from multiple threads without proper synchronization;
or may be you dealloc'ed object in one thread (ex. thread 0) and trying to access it from another (thread 1).

Resources