i am running my program using iphone simulator n at some point application crashes..but there is no error...just getting Debugging terminated in debugger console
how i can check this what is the problem of crashes?
How about memory leaks?? If you are alloc-ing a lot of variables and not releasing them this can cause memory leaks. Which will in time cause the app to crash with a black screen. Try running your app with the "Leaks" tool. Go to Run -> Run with Performance Tools -> Leaks. Go through everything you can in the app with this tool running and it will inform you of any memory leaks.
Here is a good link for information about using the Leaks Instrument:
http://mobileorchard.com/find-iphone-memory-leaks-a-leaks-tool-tutorial/
Also check your code!! If you know where its crashing go and check the code and make sure your doing everything you intend to!
Try to look into crash logs. You can find them in ~/Library/Logs/CrashReporter
Related
Ok, so heres the issue. I'm attempting to debug an app with instruments but every time i try to use the Leaks instrument Instruments crashes about 3 seconds into it. This only occurs when i try to use it with an actual device, it will run fine when its just attached to the simulator.
I have reinstalled Xcode and Instruments on 2 different computers, and am running the latest version. This isn't an issue with the app either because i have tried it with 2 other apps and the same thing happens. Also, i have tried this with multiple different devices and the same thing is happening.
Any suggestions?
I was just experiencing 100% reproducible crashes in Instruments (not very productive) that seem to have been fixed by rebuilding the spotlight index (sudo mdutil -E /), so that might be worth a try for anyone who can't get Instruments to run for more than a few seconds.
Before running you instruments, go to:
File->Recording Options->disable "Record reference counts"
I have an app that is crashing on the device (works well in the simulator) which leads me to assume that maybe it's a memory issue...
When it crashes, there is no message whatsoever reported in the console.
It does not crash each time a certain action is taken, it crashes at different points of time always after the app has been running and in use for some time.
I know I'm supposed to ask a more specific question - but if anybody is able to tell me where to start trying to track down a crash that does not report in the console, I would really appreciate it!
I am now using the latest version of XCode (4.2)
Thanks in advance...
It very-well could be a memory issue. If that is where you want to start your diagnostics, you can use the built-in Xcode profiler. In Xcode Product->Profile will get you started.
Maybe setting the NSZombiesEnabled value to YES in Project -> Edit Active Executable -> Arguments -> Variables is also helping; this will show you memory access errors based on accessing released objects. But in that case you should at least get a SIG_ABRT or BAD_ACCESS error ...
You can also log when the app receives a memory warning in the didReceiveMemoryWarning functions of your view controllers - this is called before the system is throwing out stuff when memory gets low. That of course could lead to a crash with nothing showing.
First, relax.
Then read this Technical Note.
Now, follow these steps:
From /Users/<username>/Library/Developer/Xcode/DerivedData remove all folders.
From /Users/<username>/Library/Application Support/iPhone Simulator remove all folders.
Clean your trash.
Remove app from device.
Build and run application on device.
Follow the steps that leads toward a crash.
Now, go to XCode->Window->Organizer and select "Device Logs" your device from the DEVICES pane. Select the most recent of these which has your application's name. Wait for XCode to symbolicate the crashlog. There are two possibilities now:
Its a low memory crash.
Its a memory management related crash.
If its option one, profile your application in Instruments.
If its option two, you should see the stack frame where you application is crashing (or your module's stack). This SO question will be very helpful
If you cannot understand the output (or you think the crashlog is not symbolicating - or that its not your code that's crashing), please post the crash log's crashing thread's stack here and I'll look into it.
PS: in the first section we do the first two steps to make sure there are no left-over .app/.dSYM files which might hinder symbolication later in the process because XCode symbolicator is not that intelligent.
Basically
what is happening is I was using leaks and it was being flakey, Working correctly at random times and not others. And now it decided just not to work, I launch it from Xcode Run -> Run with PErformance Tool -> leaks and it starts launching the application but stops and appears to crash.
I don't have any warnings, errors or even analyzer marks.
So... Is there a way to debug Instruments? or at least see why it's crashing the App?
The annoying part is I know I have 5 small leaks left that I may or may not have fixed...
I found Instruments has a crash log out in the library... Did the trick to find out what my problem was.
My program is crashing when using the memory leak instrument in xcode (yet it is showing no memory leaks). I would like to be able to run the debugger console at the same time to see what's happening. Is this possible? thanks
Yes - in the simulator at least.
The way to do this is to first run your app in instruments, then stop the app (this just makes sure Instruments knows about your application and that Instruments is up and running). Then restart the app in the debugger.
Now go back to Instruments, and select "attach to process" - selecting your application from the drop-down. You can start recording now and the debugger will also be functional.
I'm not 100% sure it's possible, but if it is, you would do it by starting from Instruments or XCode, and then in the other one attach to the process. In XCode you do this by going to Run -> Attach to Process. In Instruments you do it by going to Choose Target -> Attach to Process, in a new window.
If you just want to see NSLogs and other debug messages, you can open the Console app.
When I start my iPhone application it boots up fine, shows the first settings screen and all after I have given input and pressed save, the debug window says
Debugging Terminated
without any hint to why in the crash logs.
First I thought it was my programming, but then I went ahead and tested the app on multiple 'real' iPhones and it never crashed.
Why does the simulator keeps crashing?
A common cause of crashes on the simulator but not the device and vice versa is using precompiled libraries that were compiled on the other hardware. Check if you've got something compile for ARM that is trying to run on the Intel.
In XCode try Build > Clean All Targets
Have you tried resetting the simulator? iPhone Simulator -> Reset Content and Settings
Then do a clean build of your project.
Annoying :)
Put NSLog statements around where you think that it's crashing and look at the output. That shoud give you more of an idea where the crash is occurring.
If that doesn't help, post the lines causing the crash in the question and see if anyone can help then.
Sam
This tends to happen when you declare a variable and then use it without actually creating it. I would check variables you are using to make sure you are actually creating them before using (i.e. with alloc or the convenience methods).