先推荐ios 必读文章 App Programming Guide for iOS ,请在苹果官网搜索,并仔细阅读所有内容

State

Description

Not running

The app has not been launched or was running but was terminated by the system.

Inactive

The app is running in the foreground but is currently not receiving events. (It may be executing other code though.) An app usually stays in this state only briefly as it transitions to a different state.

Active

The app is running in the foreground and is receiving events. This is the normal mode for foreground apps.

Background

The app is in the background and executing code. Most apps enter this state briefly on their way to being suspended. However, an app that requests extra execution time may remain in this state for a period of time. In addition, an app being launched directly into the background enters this state instead of the inactive state. For information about how to execute code while in the background, see Background Execution.

Suspended

The app is in the background but is not executing code. The system moves apps to this state automatically and does not notify them before doing so. While suspended, an app remains in memory but does not execute any code.

When a low-memory condition occurs, the system may purge suspended apps without notice to make more space for the foreground app.

注意这个图,程序进入background或者挂起了或者停止后,再次active前一定会经过inactive状态!

UIApplication.sharedApplication().applicationState 是UIApplicationState 类型,关于这个类型的说明如下:

  1. An app may be active, inactive, or running in the background. You can use the value in this property to determine which of these states the app is currently in.

这里提到了应用程序运行中的3种状态,所以没有包含Not running 和 suspended 2个状态。

这里举一个inactive的状态的例子:

程序退到后台后,收到UILocalNotification ,点击通知消息对程序进行唤醒,调用

didReceiveLocalNotification方法时,得到的是UIApplicationState.Inactive状态。

ios The App Life Cycle的更多相关文章

  1. 【iOS】app的生命周期

    对于iOS应用程序,关键的是要知道你的应用程序是否正在前台或后台运行.由于系统资源在iOS设备上较为有限,一个应用程序必须在后台与前台有不同的行为.操作系统也会限制你的应用程序在后台的运行,以提高电池 ...

  2. The App Life Cycle & The Main Function

    The App Life Cycle Apps are a sophisticated interplay between your custom code and the system framew ...

  3. ios h5 app avalon tap点击事件失效及点击延迟300ms问题解决方法

    1.ios h5 app avalon tap事件失效 使用MUI制作app界面,使用avalon.js渲染数据,发现在(Android上正常)ios上运行时容器div的avalon的ms-on-ta ...

  4. iOS 为什么app都是异步编程

    iOS 为什么app都是异步编程 对本文题目首先需要了解一下什么是异步编程,异步编程即多线程编程. 多线程是一个比较轻量级的方法来实现单个应用程序内多个代码执行路径. 在具体理解多线程之前先看一个都理 ...

  5. ios安装app提示【未受信任的企业级开发者】。在设置中信任此开发者

     最近在测试app,ios安装app后点击提示如下图: 解决方法: 1 点击 [设置] >[通用] >[设备管理]   2 点击企业级应用 > 信任该开发者 > 信任.设置之后 ...

  6. 【如何快速的开发一个完整的iOS直播app】(美颜篇)

    原文转自:袁峥Seemygo    感谢分享.自我学习 前言 在看这篇之前,如果您还不了解直播原理,请查看这篇文章如何快速的开发一个完整的iOS直播app(原理篇) 开发一款直播app,美颜功能是很重 ...

  7. 【如何快速的开发一个完整的iOS直播app】(采集篇)

    原文转自:袁峥Seemygo    感谢分享.自我学习 前言 在看这篇之前,如果您还不了解直播原理,请查看这篇文章如何快速的开发一个完整的iOS直播app(原理篇) 开发一款直播app,首先需要采集主 ...

  8. 【如何快速的开发一个完整的iOS直播app】(播放篇)

    原文转自:袁峥Seemygo    感谢分享.自我学习 前言 在看这篇之前,如果您还不了解直播原理,请查看上篇文章如何快速的开发一个完整的iOS直播app(原理篇) 开发一款直播app,集成ijkpl ...

  9. 【如何快速的开发一个完整的iOS直播app】(原理篇)

    原文转自:袁峥Seemygo    感谢分享.自我学习 目录 [如何快速的开发一个完整的iOS直播app](原理篇) [如何快速的开发一个完整的iOS直播app](播放篇) [如何快速的开发一个完整的 ...

随机推荐

  1. Yii2 使用 Joins 查询

    Join() JOIN_TYPE = INNER JOIN, LEFT OUTER JOIN, RIGHT OUTER JOIN, FULL OUTER JOIN 等等 语法 $query = new ...

  2. oarcle数据库导入导出,创建表空间

    oracle导入导出(前提,本机已经安装oracle和oracle客户端)导出命令: exp username/password@192.168.1.138/ORCL file=c:\test.dmp ...

  3. LINUX命令总结 -------来自 水滴娃娃 的CSDN

    LINUX命令总结 标签: LINUX命令总结 2014-01-27 15:54 41039人阅读 评论(1) 收藏 举报  分类: linux(1)  版权声明:本文为博主原创文章,未经博主允许不得 ...

  4. asp.net core 中的MD5加密

    尝试了很长时间,但是一直报core 5 不可用,当时就崩溃了. 但是偶然的机会 我添加了Microsoft.AspNet.Identity 之后.MD5就好用了. 估计是这个报实现了core5下的MD ...

  5. vim关于 引号和 括号的 高效操作-很好很强大的!

    http://blog.csdn.net/bigshady/article/details/6019963 对括号匹配, 进行跳转, 使用的是%. 匹配的括号, 都会被高亮显示, 但是: 根据光标的 ...

  6. apt-get方式安装lnmp环境

    安装nginxsudo apt-get install nginx安装php和mysqlsudo apt-get install php5-cli php5-cgi php5-curl php5-my ...

  7. -bash: sudo: command not found Error and Solution

    文章转自: http://www.cyberciti.biz/faq/debian-ubuntu-rhel-centos-linux-bash-sudo-command-not-found/ 安装su ...

  8. Linux服务器管理: 日志管理(一)

    1.日志管理介绍: a.日志服务:在CentOS6.x中日志服务以及由rsyslogd取代了原有的syslogd服务.rsyslogd日志服务更加先进,功能更多.但是不论该服务的使用,还是日子文件的格 ...

  9. Java实验1-文件IO

    目标:掌握Java类的创建,Java  I/O操作,Java集合类的使用等 内容: 王老师非常喜欢读书,为了便于查阅,他每次买书回家后就在笔记本上登记每本书的详细信息(书名.作者.出版社.出版日期.价 ...

  10. Myeclipse右键新建项目突然变的很少

    额,很是焦躁,最后在界面的右上方点Myeclipse Java enterprise变回原来模样