Enabling and disabling multitasking within application
-
28-09-2019 - |
Question
Currently, my iPad application implements multitasking. However, I would like to offer the user an option to disable multitasking. Is this possible, given the fact that you cannot modify the Info.plist dictionary where the UIApplicationExistsOnSuspend
key is set?
Solution
Well, you could set a flag in your application delegate that would simply exit your app when the flag is TRUE within the delegate method applicationDidEnterBackground:
, like this:
@interface MyAppDelegate : NSObject <UIApplicationDelegate> {
BOOL multitasking;
...
}
...
@end
@implementation MyAppDelegate
- (void) applicationDidEnterBackground:(UIApplication *)application {
if(!multitasking) {
exit(0);
return;
}
...
}
...
@end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow