App Crashes on Opening - iphone

I have an app that keeps crashing as soon as it starts. Not sure why. I have image views and buttons in the main xib file. The main xib file is not mainwindow, it is firstview, so i changed it in the plist to the firstview. There may be something wrong with the xib file for firstview but it only has buttons and images and a view in the back. There are no warnings or errors when I run it, just Debugging Terminated when it crashes.

To Debug a crash problem, especially on a small application, do a binary search on removing functionality and adding it back in until you find the smallest thing that when removed makes the crash go away, and when added back in causes the crash. Sometimes this bottom-up search approach is easier than the top-down analytical approach to finding what is the problem. Then when you know what is causing the problem, it's generally much easier to focus on why it is causing a problem.

What's the very last change you made before your app started crashing? That's the one that caused your problem. If you made a lot of changes at once before running your app to test them, now you know what that's a Very Bad Idea (tm)... :-(

You probably want to switch it back to mainWindow, and then add the view as a subview in the app delegate did finish launching. also, you may want to set a break point on obj_c_exception_throw.

Related

Slow defaults access for key ClientState warning on iOS

I'm getting a "Slow defaults access for key ClientState took 0.034635 seconds, tolerance is 0.020000" warning when testing my iOS app - it seems to occur intermittently. I've tried to look around to see what it is about, but I'm not entirely sure! Any help appreciated, thanks.
My best guess is that the first Viewcontroller is taking to long to load.
I never got this message until adding a large background png to the first view controller which now exhibits the same behaviour but all the time. Take out the png and I did not get it on 5 loads.
Guessing same as depicus: first viewController loads too long.
In my case app starts by populating tableView from last saved CoreData. Right after that server tells me authorization has expired, I start re-auth and facebook login view comes on-screen - on top of tableView.
This is were I get that error. Without facebook login, everything is ok == fast enough.
SMSidat - I had the same problem and was looking found forever. I have an sqlite database and upon loading the vc that accessed the database it stated "slow defaults .....clientState took to long to load and all.
Try to remove Auto Layout from your nibs. Once I did that, no more "slow defaults...warning"!! Even though this is from 3 years ago...Hope it can help someone out.
Here is a link to the tread that helped me out
Slow UIViewController load time (slow ClientState warning)
In my experience this is cause by the time it takes to load a view when you invoke it. Take my case for example. I had a TabBar app and in one of my tabs it was a gallery. I was calling the view but within the view I was fetching everything on the main thread (big no no)... obviously, User interaction was gone out the window and the app will lock until done. The phone will take its time to load the images and to present the view. Once I multi-threaded my application and the pictures loaded in the background no more warning. Hope that helps, I am not sure how this warning works underneath but that changing this things got rid of it. :)

tap back immediately after moving the map crashes application in iPhone

I came across the scenario where in if after moving the map immediately if I tap on back icon while the map has not fully loaded
The application crashes.
What I can understand is Since the loading is still in progress and I tap back the the application releases the controller but the google map loads asynchronously in NSRUNloop (not sure). So that might be the problem not sure though.
So does anybody know what can be the issue and is there any way to solve this issue?
Please comment if more description required.
It sounds like that when you close the view, the object that is the delegate for the completed map load has been deallocated, causing the crash with a bad access.
A good way to get to the bottom of these types of crashes is to use Instruments (part of the Xcode suite to tools) and go zombie hunting.
For anyone who is still searching for the answer
What exactly happening was that map view events were getting fired even if the controller was released causing a crash in the app.
So the solution is Before setting the value of objMKMapView to nil you need to set value of objMKMapView.delegate to nil.

How to control the crashing of my app when i switch between tabs

I have created a music application in iphone .
The App crashes if i keep on switching between the tabs while the song is playing.
How can i solve this problem .Please anybody help me regarding this problem
Generally such kind of issues are memory related.......just check whether ur releasing the objects at proper place or not..
Other u can put some code snippet to have a look so that we can know actually what's happening with your code..
A common cause for crashes when something repetitive happens (eg switching between tabs, screens etc) is memory problems. Make sure you are releasing the correct objects in the right place. It could very well be that every switch you are allocating objects - without freeing them when switching again. This will eventually consume your memory and crash the application.

iPhone Application Crashes (probably from multiple views use)

I am preparing an iphone application in which I am using many transition among view controllers.
This means that there is one main menu view controller and after i press the necessary box, a modal view controller is being pushed. After this, I press an exit button and come again to the main menu and I can reenter.
The problem is that when I enter and exit my viewcontrollers many times, the application crashes and I have many object allocations in my instruments (but no leaks).
I also use many UIImageViews.
Any suggestions on what may be wrong?
Thank you very very much!
(using iphone OS 3.1.2)
Off the top of my head, there are a couple of things that might be going wrong:
You have either an over-released instance variable (EXC_BAD_ACCESS crash), or
You are using too much memory (i.e. you are not releasing any of your allocated objects) and you get a LowMemory crash.
Can you post a crash log? (If you're testing on a device, you can find out by checking the crash log in Xcode: Window->Organizer->iPhone Development(sidebar)->Crash logs.
You may be trying to access a member variable that has already been released. One way to find out where the application crashes is to click on the "Checkpoints" button in the toolbar and run the application.
When it crashes, open the Debugger window (Cmd-Shift-Y) and look for one of your methods in the stack trace. This location is usually where you're doing something wrong.

iPhone Bug App bug Question and challenge

Ok so I've got a really annoying bug in my app. It's driving me crazy and I'm sure it's beyond my skill level as I am learning as I go.
Here is the initial rundown of the bug: A shot in the dark - Application bug
However I have found a way to consistently reproduce the bug (only on the device not in the simulator)
First you create a new Pool and save it. Then add 20 blank time entires into one day. Save it and this is where the problems begin. (when you go back to the main detail view the tableview has put itself out of editing mode with being told to do so). Now if you go back to the day to see the time entries you just added they are still there.
If you go back to the main overall tableview listing all pools and now go back to the day you added the times they have dissapeared.
Add one time and it all saves fine. Add twenty and it doesn't save. WTF!!
Main Menu listing Pools:
Detail view:
Edit View:
Time Edit View:
Add a time:
I'd appreciate any more guesses. But as well as this question I'm offering a bounty of £25 (Sorry I'm a poor student) to whoever is good enough to fix this bug first!
if your interested my email is danmorgz[at]gmail.com
Thanks,
Dan
If you haven't already done so, I'd recommend turning on NSZombie support and seeing if you're using any of your objects after they've been freed. As far as I know this can be turned on in the simulator and on the device.
Most likely, you're failing to retain some object somewhere along the way. When an object gets released and then the memory is re-used for something else, you'll get all sorts of bad behavior, including crashes, or mysterious "disappearance" of other objects.
One thing you can try is putting breakpoints into the -dealloc method of your custom classes. Then you can see where they're getting deallocated from. Most likely though, this will end up being when the AutoreleasePool gets drained, which won't tell you much.
Alternatively, look into using some of the memory debugging tools built into Cocoa.
That document is for Mac OS X, but I think most all of this will work in the iPhone simulator, at least. I know that your bug "doesn't happen" in the simulator, but that really only means that the symptoms are different, and you're not noticing them.
Thanks for all your answers. It's now fixed.
For those interested I'd forgotten to add a cellidentifer in the XIB of my cell subclass.
cellForRow: method was therefore creating a new cell every time. The memory got filled up very quick. It then seemed as though my app was automatically trying to cut the fat by forcing another tableView out of editing mode and not managing my instances properly.
Again it's a memory problem. Isn't this always the case!?!
The clue was a one off 101 error in the console indicating my app was using too much memory. Oh and a slow scrolling tableView.