views:

98

answers:

2

Hello all,

I've been working on an iPhone for several months. It's a 2d shooting game akin to the old Smash TV type games.

I'm doing everything alone and it has come out well so far, but now I am getting unpredictable crashes which seem to be related to CoreFoundation forking and not exec()ing, as the message __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONA LITY___YOU_MUST_EXEC__ always shows up somewhere in the debugger. Usually it shows up around a CFRunLoopRunSpecific and is related to either a timer firing or _InitializeTouchTapCount. I cannot figure out exactly what is causing the fork to occur. My main game loop is running on a timer, first updating all the logic and then drawing everything with openGL. There is nothing highly complex or unusual.

I understand you cannot make CF calls on the childside of a fork, or access shared memory and things like that. I am not explicitly trying to fork anything. My question is: can anyone tell me what type of activity might cause CoreFoundation to randomly fork like this?

I'd really like to finish this game and I don't know how to solve this problem. Thanks for any help.

A: 

Try breaking on fork in the debugger and see where it's happening.

Chuck
I tried but for whatever reason it isn't breaking on fork() or __THE_PROCESS_HAS...(etc).
Tom
A: 

So I was wrong. It looks like CoreFoundation forking wasn't causing the problem after all. I just had a dangling pointer somewhere that made it seem like a bigger problem than it was and always left that message somewhere in the debugger. Thank you to anyone who took time to view this question though. For any other non-expert xcoders having trouble debugging a problem, here's some links I used to learn more:

Helpful for objc_msg_send crashes: http://www.sealiesoftware.com/blog/archive/2008/09/22/objc_explain_So_you_crashed_in_objc_msgSend.html

Debugging magic: developer.apple.com/mac/library/technotes/tn2004/tn2124.html

Thanks, Tom

Tom