After XCode 4.2 installation my old app cannot be run. The build is successful but once simulator tries to run the app I get an error:
Thread 1: Program received signal SIGABRT
It points to this line in code in main function:
int retVal = UIApplicationMain(argc, argv, nil, nil);
No errors in the log other than:
(gdb)
Does it have to do with autoreleasepool in iOS 5? Where to look for an error? I doubt this is a code related issue because I was just running this app fine in older Xcode. This is an iPad app.
Go to Build settings -> architectures
try to set the Valid architectures to armv6
i think it will help you
Its not because of main function..
you check in GDB is there any unrecognized selector or memory leak issues..
Go to product button of xcode-->Edit scheme-->select run (second cell of left hand side table) -->select Diagnostics--> Enable zombie objects....
After changing this setting clean and run your project you will the reason of crashing
This could be an instance of this issue. I.e., you have a simulator process that's wedged, and you need to reboot your machine to clear it out.
Related
I'm with some really weird problem here.
Every time when I add a second image view, the program crash: "Couldn't register ken.word with the bootstrap server. Error: unknown error code.
This generally means that another instance of this process was already running or is hung in the debugger.(gdb)" (SIGABRT)
it goes SIGABRT on this part of the code:
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
but when I just add one image view, it goes perfectly well.
I've tried to restart the Xcode, even restarting the mac, and it didn't work.
I've also tried to create another project, and it didn't work either!
I'm using Xcode 4.2
Quit your XCode and Simulator then try again. It will work. And never quit your simulator when it is in running mode, first stop the program then quit.
And if you are running your app in your device then delete your app from device, switched OFF your device then ON and try.
I use Xcode 4.2 and I get 90% of the time this message:
#autoreleasepool
{
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
Thread 1: Program received signal "SIGABRT"
When it works and quit iOS Simulator I get :
Thread!: program received signal SIGTERM
NOW ALL the programs (even simple tutorials with single sound button) that worked perfect before when I quit Simulator I get SIGTERM and when I try to run again I get SIGABRT.
I am getting paranoidddddddddd.
Error: unknown error code.
This generally means that another instance of this process was already running or is hung in the debugger.sharedlibrary apply-load-rules all
Current language: auto; currently objective-c
(gdb)
What am I supposed to do?
Some things for you to try that have helped me in the past (in this order):
Product > Clean
Uninstall/delete your apps from your devices manually.
In iOS Simulator, iOS Simulator > "Reset Content and Settings".
Delete everything in your "Derived Data" for the projects causing the problems. (Screenshot) In Organizer > Projects.
Quit xCode.
Restart your machine.
I've noticed that Derived Data causes the most problems when you make multiple projects with the same name, wether it's on purpose, or by accident.
Edit: More details..
The only time I've ever gotten SIGTERM is when you run a test on a "device" and then quit the app from the device before you hit stop in xCode, then try and launch it again on the device. If it was more of a SIGABRT problem, I always check my IBOutlets. SIGABRT happens every time you delete the code for an outlet, but don't delete the connection in IB. [xcode 4.2.1]
The previous app is still 'stuck' in the simulator. Try completely quitting the simulator, cleaning your project, then trying to build again.
Edit: A complete restart of your mac sounds like the next step. In my experience this error has always had to do with an issue with the simulator, rather than the code itself.
SIGABRT means that your program is throwing an exception. If you don't explicitly set a breakpoint to trigger when the exception is thrown, then Xcode shows you the SIGABRT in main, which is useless for debugging.
You need to add an exception breakpoint so you can see where the exception is being thrown.
I'm facing unexpected crashes of my app running on an iPhone 4 with iOS 5.0.1, the app crash without generating any error message nor crash log. I did also enabled zombies and tested with Instruments with no luck... how can I figure out where is the problem? I'm totally stuck :(
ps. I'm using ARC and my app is multi thread (NSOpertations + GCD)
(By popular demand:) There are some hints for catching the failure in this thread.
From the breakpoint-menu in Xcode, press the little '+' button at your window bottom left, and add an exception breakpoint. It will give you a heads up if the app throws an exception due to erroneous code.
Just follow this url you will get trick to track the causes of crash.
add some breakpoint before crashing point and add a lot of NSAssert to check your assertion.
I pressed alt+cmd+r and activated NSZombieEnabled in Arguments > Environment Variables. Additionally, I activated it in Diagnostics > Memory Management > Enable Zombie Objects.
However, when I built and run, at some point my app crashes giving me this useless message in the console:
*** -[CALayer retainCount]: message sent to deallocated instance 0x656b260
The stack trace is just as useless. I moved the details-level slider all the way to the right. Thread 1 simply shows me this:
Everything is system-owned and there's not a single line related to my app. So obviously NSZombiesEnabled doesn't work as it did in Xcode 3, where it halted on the dead object.
Is there any way to figure out which CALayer is deallocated too early?
Update: So after building and running about 100 more times suddenly the problem DISAPPEARED! It's completely gone! And the best part: I did not modify my code in any way! Inbetween I cleaned the build folder and project with the clean commands several times and deleted the app in the Simulator several times as well.
Update 2: Fortunately the problem re-appeared. And now it seems persistent. Fortunately, because I prefer finding the root cause rather than annoying the users by random.
Update 3: Finally found it by accident:
startButton = newBttn;
should have been:
self.startButton = newBttn;
startButton was a retaining property and in -dealloc I released it. So it got overreleased and in most (but not all) cases after the view faded out it crashed giving that weird CALayer retainCount message.
The Zombies Instrument (CMD + I) finally pointed out that it had to do with a button. Just didn't know why and where.
Clang Static Analyzer didn't complain about this obvious glitch.
If this crops up again, you can run a dedicated Zombies instrument. Hit Command+I to profile the app and select the Zombies instrument (you must be running on the simulator). If you get a zombie, you can display the entire memory history (each retain/release) for that object, which is immensely helpful in tracking down errors.
In addition to Jeff's great answer; to do almost the same thing, but without having to open Instruments or profile your App, you can set NSZombieEnabled, MallocStackLogging, and guard malloc in the debugger. Then, when your App crashes, type this in the gdb console:
(gdb) info malloc-history 0x543216
Replace 0x543216 with the address of the object that caused the crash, and you will get a much more useful stack trace and it should help you pinpoint the exact line in your code that is causing the problem.
This article has some additional info.
It seems in iOS 4, because your app goes into the background, it remembers where you last were. When I quit my app by pressing home, and then click on it again in the simulator shortly after, it remembers where it was and AFAIK it is working.
When I kill the app by double tapping home, holding the icon of my app in the bottom, pressing the delete key, then clicking on the normal icon to start the app, the app immediately crashes. I get:
Thread 1: Program received signal: "SIGKILL".
at the line
int retVal = UIApplicationMain(argc, argv, nil, nil);
The console just says:
[Switching to process 46794 thread 0x207]
sharedlibrary apply-load-rules all
Current language: auto; currently objective-c
I'm not sure where to go to start debugging this. Thanks!
In my not so bast experience the simulator and XCode don't have great communication. The console does get all the outputs it should when you're running but once you switch to another App, close it, or whatever, nothing will work as expected.
When I run the an up from Xcode into a real iPhone, if you close it, Xcode will still lets you STOP it.
If the app actually crashes you should look into the crash logs.
You should also try using Instruments
To not get a crash on your device you need to disconnect it from your computer once the application has been copied over. Then you can exit it and restart it without issues.
Once you completely shut down the app, I think the debugger loses all communication with it. If the app is in the background the debugger still reattaches I think when you launch it. If you completely close the app on the phone, and wanted to debug and view it through the console in Xcode, you would need to start the app from Xcode again.