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.
Related
When I activate my WatchApp InterfaceController. First thing it does is attempt to wake up the parentApplication (or as according to documentation, activates it in the background) by calling "OpenParentApplication" method.
However, The method is unresponsive until I manually activate the app on parent iPhone. It also greets me with a "XXX Unexpectedly Quit", which means when I was calling my host App, for some reason it crashed it.
After the activation, I can freely exchange information with the "OpenParentApplication" method.
According to documentation, the method
Essentially, just calling the method should wake up the parent regardless of the reply closure.
My code is extremely type safe, with nil value causing the crash out of the question, what could it possibly be?
PS: I cannot debug the host App since I can only attach to process after the host app is launched, which it never did.
Since openParentApplication launches your application in the background, a number of methods that would automatically be called when your application launches will not have been called. For instance, in a normal launch your initial view controller will be calling viewDidLoad, viewWillAppear, viewDidAppear. If any of these methods configure critical aspects of app state on which non-interface elements rely, then your app is at high risk of crashing when launched in the background—but the app would not crash if it had been previously manually launched before openParentApplication was called.
Actually you Can debug main application after launching watch extension. After your extension started in Xcode go to Debug -> Attach process -> your main app.
This will enable you to use breakpoints and logging. If your app is missing there, try launching it on device first and then go and try attaching it again.
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.
When I double tap the home button and quit out of my app from the multitasking bar and open the app again, Xcode reads: "Thread 1: program received signal: SIGKILL" and freezes my iPod. The app has 1500+ lines so I can't really put any code up, sorry. What could I be doing wrong?
Your 1500+ lines of code is really innocent of this crash.
It happens when you run the app from Xcode, and terminate it from the iPod, without stopping the execution from Xcode. Closing the app from multitasking bar doesn't stop its execution in Xcode(but, I always expect it to do). So, when you open it again, the Xcode throws that SIGKILL exception. And, it doesn't do any harm to your app. No need to worry about it.
And, ofcourse, I don't know any technical explanation for this behavior. I am not that genious ;-)
That's normal, your app is receiving a signal that it has to terminate.
Just make sure that when it does, you handle it properly in one of the UIApplication delegate methods, so that no information is lost, and such.
I want to test my app on device and see all the NSLOGs on console while runnig the ap on device.I also want to stop the app at breakpoints but app does not stop on breakpoints and not print NSLOGs .I have unchecked load symbols lazily .I am using a debug build .Please tell me how to achieve this
Thanks in advance
NOTE:After starting the app x code shows the app being debugged is not being run (I think the problem is after xcode transfers the app to device then it disconnects with device)
Do you have breakpoints enabled in xCode?
Should be looking like this;
Try to set breakpoint in the didFinishLaunchingWithOptions then the viewwillappear of the view you want to test the breakpoints on. basically any places before your code (which you want to test) which surely get called.
I had same problem before not exactly sure why does it happen though.
it's like preparing Xcode to look for breakpoints :)
Sounds like you're working with a jailbroken device .. Is that the case ?
If you are , the "official" answer should be "disable mobileSubstrate addons".
I've managed to run the app in debug mode , after :
Doing what you mentioned (got that error message).
Double tap home-button , hold the app icon, close the app..
Run it again from XCode.
Repeat again if necessary.