Add the following line of code to stop the iPhone from going to sleep mode. (Use it judiciously, it will drain the device battery.)

[[ UIApplication sharedApplication ] setIdleTimerDisabled: YES ];