views:

87

answers:

3

Hey there, I want to simulate the press of iPhone home button and power/standby button. Could anyone tell me how to do this?

+1  A: 

There is no public API supporting this.

muffix
Thanks for letting me know this. Perhaps could you tell me which private APIs support this?
J.Sun
[[UIApplication sharedApplication] terminate];
muffix
A: 

Your app should never quit unless the user has pressed the home button. Apple will most likely reject your app if you do.

To answer your question, to "simulate" the app closing/crashing you can use exit

exit( 0 );
aegzorz
Thank you for your reply. It helps me :D
J.Sun
Great! If this answered your question please mark it as such :)
aegzorz
A: 

Probably you want to take a screenshot of the screen from your app?

Check this http://stackoverflow.com/questions/1291110/capture-iphone-screen-with-status-bar-included

There is no public api available for taking a screenshot.

Chaitanya
hello, thanks for your reply. I tried that method given by the reference link. However, it gave me a totally black image. I guess it might be caused by my overlayview. Do you know how to render both the main window and its overlay in the video preview mode? Thank you :D
J.Sun