Is there any way to disappear an running app on processing on iPhone? Like this photo below. e.g. App Store application is my own application. I wanna do disappear it when I double clicked the home button. Any help is appreciated!
Asked
Active
Viewed 70 times
0
1 Answers
1
If you want to kill your application you can call:
exit(0);
However the app will look like it crashed. Apple don't recommend calling this function
If you want to do it in style you have to use some undocumented methods in UIApplication class. add this to your header
@interface UIApplication (Private)
- (void)suspend;
@end
And then you can call it like tis
//this will animate the app to home screening won't quit it
[[UIApplication sharedApplication] suspend];
You can set a timer after calling the method to quit the app
NSTimer* myTimer = [[NSTimer alloc] initWithFireDate:[NSDate date]
interval:0.4
target:self
selector:@selector(suspendTimeout:)
userInfo:nil
repeats:NO];
[[NSRunLoop currentRunLoop] addTimer:myTimer forMode:NSDefaultRunLoopMode];
- (void)suspendTimeout:(id)sender{
exit(0);
}

Karim H
- 1,543
- 10
- 24
-
Thanks for your answer.
But I don't want to kill this application. I just want to hide it in the process manager on iPhone.
So the step is:
1.Open an application and keep it running. 2.Double click the home button 3.Hide this app from the process manager on iPhone instead of killing it. – Johnny Jun 20 '16 at 11:44 -
It looks like that it will not show when you double click the home button. Maybe it is difficult to manipulate. – Johnny Jun 20 '16 at 11:36