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.
Related
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.
I am getting a lot of strange EXC_BAD_ACCESS crashes on the iPad that only happen on the device and not in the simulator. I am assuming that they are somehow memory related, but I am not sure. They all happen with image context related functions.
One strange example is using CGImageCreateWithImageInRect. For example, if i run through a bunch of UIImages and crop them with CGImageCreateWithImageInRect, it will always crash at specific arbitrary sizes. Like, if I crop them all to 200x200, it crashes out after processing 12 images. If i crop them to 210x210, it works no problem.
The EXC_BAD_ACCESS happens inside of "memmove" called from "CGBlt_copyBytes". That is all the debugger shows me strangely enough. I can't see the callstack going up to any of my methods.
All of this works fine in the simulator!
I know this is all very vague, but if anyone has any ideas, they would be greatly appreciated.
Start by doing things like checking for zombies, and running clang (Build & Analyze) to see if you have memory management issues. I think you'll need to post more code, because this does sound like memory stomping.
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!
What does the error warning: check_safe_call: could not restore current frame usually indicate? I've read in other places that it's a memory issue. Is it always a memory problem?
I'm getting this error on the device (not the simulator). NSZombieEnabled shows nothing. If I Build and Debug, my debugger window shows nothing. The peak memory isn't that high (3MB). It just crashes with the same error every time after scrolling around a map.
Any ideas how to debug this? Thanks.
Edit: I added the reason for my crash in an answer below (creating too many SQLite connections). If anyone else gets this error and finds their solution, please post it below. It seems like an error message with multiple causes.
I've seen this a few times, but never been able to actually pinpoint it to a problem outright. Although, the times I've seen it usually there has been some kind of infinite loop or recursion gone wrong and the debugger will catch it. I don't know if you've left it long enough, but after a while, the debugger should start to load the stack frames it does have and display them in the debugger window. There you should be able to see what is going wrong.
Like I said, usually when I've seen this its been due to infinite loops or recursion and the debugger will show upwards of 5000 calls to the same function, so finding the problem shouldn't be too difficult - but, saying that, it may not be the exact issue.
Just my two cents.
This warning also may happens when to use stack based block out of the scope the block defined without copying it.
http://developer.apple.com/library/mac/documentation/cocoa/Conceptual/Blocks/Articles/bxUsing.html#//apple_ref/doc/uid/TP40007502-CH5-SW2
http://www.friday.com/bbum/2009/08/29/blocks-tips-tricks/
I came accross this problem too but I found that it was caused by an image that was at too high a resolution. It would work perfectly in the simulator but not on the device. I resized the image to 320x480 pixels at 180 pixels per inch and now it works perfectly.
Hope that helps
I found the error in my code. It turns out that the SQLite database I was using was causing the crash. I was forgetting to close my database connection, and each time the code hit a particular function, I'd open a new connection. Eventually there were too many, and the app crashed.
It's looking like a lot of these errors are to do with a kind of overload (as Jasarien says).
I've developed my application using my 3G device to test with. Upon giving this to a friend to test, he's noticed that it crashes..I've had a look at the crash log, but it's not much use except for the "EXC_BAD_ACCESS" statement after a few memory warnings.
On my device, I can use the imagePicker lots, and each time a photo is taken I get a memory warning, but this doesn't cause any problems.
On my friend's device (also a 3G), after a couple of images chosen from the camera, the app crashes.
So, my question is.. I think something is being deallocated because of the memory warning - but only on my friend's device, and then after deallocation, it's trying to be used again. How can I find out what object is being called? I can't use NSZombies because this is a remote (beta) device.
Help please!
Also if anyone has any ideas why my device can pick image after image without any problem and his can't...that would be most helpful
Thanks!
EDIT: New discovery.. I'm getting this error message too: KERN_PROTECTION_FAILURE which I understand to be something to do with data access. The crash seems to happen right after I save the image got from the UIImagePicker. Any ideas?
You may be over-releasing something. If you're running Snow Leopard, run the Static Analyzer (Cmd-Shift-A) and look for memory errors.
The fact that it crashes after a memory error suggests that a UIViewController has released its view. Do you have any UIViewControllers that observe NSNotifications, or otherwise might change their IBOutlets while they are off-screen? This is a common cause of this kind of crash. Make sure you're correctly memory managing your IBOutlets. UIViewControllers should never mess with their IBOutlets (or their UI components at all) when they are off screen. Even if you don't make this mistake, if you're not implementing things as noted in the above link, you can still crash after memory warnings.
MemoryWarning was a pretty good idea, and things have improved, but Apple still hasn't quite cooked all the issues around how it plays with UIViewController. The developer still needs to be very careful.
You should have your friend come to your computer and run it with NSZombieEnabled. That's the best way to debug these issues.