iphone app only works first time on simulator - iphone

I've got an issue with my iphone App and i'm not sure if its an xcode project issue or a code issue (I'm leaning towards xcode project issue at the moment).
If I reset the iphone simulator and build and run my app it works fine. If I then do a build and debug again the app will crash straight away with no meaningful callstack. The app will continue to crash until I remove it and start again. I didn't previously have this issue which makes me think i've just changed some project setting recently by mistake.
Has anyone had this before or can anyone think or a reason for this issue?

Are you saving/retrieving state? Without any other details, that's the first area I'd look into. Also try setting breakpoints and debug to pinpoint the problem.

paul_sns is correct, try setting breakpoint on your AppDelegate class and step-over. Probably you're retreaving a state that is incorrect. You could also activate the debugging console (run the application in debug mode) to see where it crashes (the callstack).

OK I've finally got to the bottom of it. I had quite a lot of memory overwriting going on (a sizing issue with a 2d array) and this was why it wasn't giving me any useful information when it crashed. Thanks for all the help - am glad I stumbled upon the problem before I pulled all my hair out!

Related

iPhone up no longer loads into device or emulater, just does nothing when i run it

When I try to run my app, it builds with no errors, but will not run.
At the top of the Xcode window it says “Attaching to golfflixlight” with a little animation underneath.
I let it run for 20 minutes and gave up, I'm stuck
This is a recurring scourge of Xcode. It is there to make our lives miserable. The solution is very elusive, and I have yet to read a single, coherent explanation what's happening.
Take a look at this SO question, it might give you some idea how to solve your conundrum. Personally, nothing works for me other than going to Edit Scheme, and setting the debugger to GDB. Good luck.

Crash upon iPhone Simulator 5.0 startup

I'm making an iPhone RPG application, I was working on programming a CGPoint array to some sprites I wanted to add, but I didn't make any progress and thus deleted the code.
After this, an exception was thrown each time I ran the app' on the iPhone Simulator, it said it was to do with OpenAL, so I took all of the sound code out.
The project then ran fine on the iPhone Simulator, without sound though of course.
Now, upon taking all of my newly added code out, the iPhone Simulator crashes (freezes) when it's still on the Cocos2d load up screen and points to the following line of code in Xcode:
int retVal = UIApplicationMain(argc, argv, nil, #"AppDelegate");
I've been looking over my code with a fine-tooth comb for an hour now, checking in case I left any code in or changed anything, and I haven't.
Has anyone had any experience with this problem? Or can anyone give me an idea what might have happened?
Some light to shine on the OpenAL problem would be nice too (second time it's happened to me).
The best thing to do in situations such as these is put break points all over the place and look for the point at which the applications crashes from.
If you haven't yet check out the stack for any clues. Unfortunately if there is nothing on the stack or printed from the debugger this is really all you can do.
So I checked some other questions AGAIN, and found someone saying to restart the computer... This worked. It's annoying, so so annoying. But that's what worked.
Also, for any weird errors, just make sure you Product > Clean after adding/changing any resources you use.

iOS: Crash when keyboard is used...?

Pretty simple bug:
Pressing any key on my Mac's keyboard causes an "EXC_BAD_ACCESS" error to occur when running an app on the simulator. Unless I'm entering data into a text field that is, where it works fine.
-
Not sure if this is a bug in my app, or somewhere else. If by some chance, someone was using a bluetooth keyboard with my app, then I don't exactly want it crashing willy nilly... small chance I know, but I'd still rather fix it if it's a bug. I've enabled zombies - doesn't tell me anything about where the crash is occurring, and the app still crashes.
Any thoughts or answers are much appreciated, thanks :)
Turning off "Auto-Correction" in the simulator keyboard settings fixed this issue for me.
Screenshot of Keyboard Settings in Simulator:
Seems there are still bugs with the simulator.
This bug is usually attributed to trying to access an instance that has already been released. Check your instances, anything that you allocated, released, and then you are trying to access. It may not even be connected to the keyboard, but maybe a delegate method. Post some code so we can have a better idea of it. For example, the code for the view controller that is running at the time of the crash.
Try to run your app with "Guard Malloc" on. You find this setting when you go to
Manage Scheme -> Run app (on the left side) -> diagnostic (on the top
lashes) -> under Memeory management.
This will show you the crash point where it happens and you should be able to find the reason much more easily

Xcode debugger problem

I'm trying to debug my code with the help of the debugger in Xcode, but when I'm trying to step in, nothing is happening. I tried it with another project and it's debugging fine there.
What could be the cause of this problem?
Some times xCode takes much time to calculate data, so its just shows stepping over.
In this situation you can NSLog your values to debug.

Default.png no longer exists

I've searched for the answer to this question but I can't seem to find it, and logically this process makes no sense to me...
I added a default.png to my app and I didn't like the fact that it didn't show long enough, so I removed it and was going to add a splash screen instead.
The problem is that the default.png still shows on load. I've completely removed it from the Xcode project and from the computer.
I've deleted the installed app from the simulator, and rebuilt the project but it still shows up. I've even exited Xcode and relaunched. Does this value get saved anywhere that I'm missing? How do I get rid of this image?
Any help will be appreciated.
Thank you in advance,
BWC
Have you tried doing a Clean first? I've had some resources stick around before with Xcode... the clean operation deletes all the build artifacts.