Enabling and disabling multitasking within application

Deadly 提交于 2019-12-13 04:29:54

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/4282097/enabling-and-disabling-multitasking-within-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!