iOS程序退出

时间:2014-09-05 18:20:51   收藏:0   阅读:230

程序不在后台运行,直接完全退出的方法:

plist文件中添加  Application does not run in background 设为YES


原理:在程序切入到后台后,每十分钟就去执行一个动作来唤醒程序,由此来保证它一直在后台运行。

1、在Info.plist中添加UIBackgroundModes 键值

让系统知道你的应用程序应该在适当的时候被唤醒

2、在 - (void)applicationDidEnterBackground:(UIApplication *)application  切入后台执行的方法中执行下面代码

[[UIApplication sharedApplication]setKeepAliveTimeout:600
                                                  handler:^{
                                                      //执行的代码  
                                                  }];


原文:http://blog.csdn.net/quanqinyang/article/details/39082449

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!