- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
applicationDidBecomeActive
方法何时被调用?这个方法的目的是什么?
最佳答案
了解 iOS 的状态和转换
州
未运行 - 应用未运行。
Inactive - 应用程序在前台运行,但未接收事件。 iOS 应用程序可以置于非事件状态,例如,当收到电话或短信时。
事件 - 应用正在前台运行,并接收事件。
后台 - 应用在后台运行并执行代码。
已暂停 - 应用程序在后台,但没有代码正在执行。
七个最重要的应用委托(delegate)方法
The operating system calls specific methods within the application delegate to facilitate transitioning to and from various states. The seven most important application delegate methods a developer should handle are:
应用程序:willFinishLaunchingWithOptions
Method called when the launch process is initiated. This is the first opportunity to execute any code within the app.
应用程序:didFinishLaunchingWithOptions
Method called when the launch process is nearly complete. Since this method is called is before any of the app's windows are displayed, it is the last opportunity to prepare the interface and make any final adjustments.
applicationDidBecomeActive
Once the application has become active, the application delegate will receive a callback notification message via the method applicationDidBecomeActive.
This method is also called each time the app returns to an active state from a previous switch to inactive from a resulting phone call or SMS.
applicationWillResignActive
There are several conditions that will spawn the applicationWillResignActive method. Each time a temporary event, such as a phone call, happens this method gets called. It is also important to note that "quitting" an iOS app does not terminate the processes, but rather moves the app to the background.
applicationDidEnterBackground
This method is called when an iOS app is running, but no longer in the foreground. In other words, the user interface is not currently being displayed. According to Apple's UIApplicationDelegate Protocol Reference, the app has approximately five seconds to perform tasks and return. If the method does not return within five seconds, the application is terminated.
applicationWillEnterForeground
This method is called as an app is preparing to move from the background to the foreground. The app, however, is not moved into an active state without the applicationDidBecomeActive method being called. This method gives a developer the opportunity to re-establish the settings of the previous running state before the app becomes active.
applicationWillTerminate
This method notifies your application delegate when a termination event has been triggered. Hitting the home button no longer quits the application. Force quitting the iOS app, or shutting down the device triggers the applicationWillTerminate method. This is the opportunity to save the application configuration, settings, and user preferences.
关于ios - 什么时候调用 applicationDidBecomeActive?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30748555/
我们遇到了一次奇怪的崩溃 - 现在我知道是什么原因造成的,但我注意到的一件奇怪的事情是所有崩溃日志在两个单独的背景上都有 -applicationDidBecomeActive线程 Thread 5:
我如何确定当前在 applicationDidBecomeActive 中的 Controller /窗口?例如在登录屏幕(这是一个 LoginViewController)上,如果 applicat
使用 Storyboard和 UINavigationController 我的应用程序有很多 UIViewControllers。最初的 UIViewController 被命名为 viewCont
我正在使用 NSLog 语句来了解何时调用 -applicationDidBecomeActive:,但它似乎从未被调用过。这是代码: - (void)applicationDidBecomeActi
applicationDidBecomeActive 方法何时被调用?这个方法的目的是什么? 最佳答案 了解 iOS 的状态和转换 州 未运行 - 应用未运行。 Inactive - 应用程序在前台运
我的应用程序委托(delegate)方法 applicationDidBecomeActive: 在应用程序首次启动时被调用两次。我有一些代码我只想执行一次并且我已经放入 applicationDid
在带有 RevenueCat 的 tvOS 13.4 上,当我在 4K 电视设备上运行我的应用程序,然后关闭电视(让应用程序保持运行)时,我得到以下信息: 2020-05-10 12:21:59-07
当我的手机长时间闲置并收到来自应用程序的推送时,我希望能够打开应用程序并执行网络功能。这通常有效。我在主应用程序 View 中发布来自 applicationDidBecomeActive 的通知,因
要求 - 当用户从后台 tabBar 打开应用程序时,所选索引应为 2 我尝试过的 - //For getting current visible controller - public ex
我有一个使用地理围栏的应用程序。当您越过地理围栏时,该应用程序会启动 - 但它是否会进入“事件”状态,即使它是从后台启动的?我们在 applicationDidBecomeActive 中有相关代码。
我有一种方法可以在应用程序激活时检查剪贴板: - (void)applicationDidBecomeActive:(UIApplication *)application { [[NSNot
这是我的应用委托(delegate)中 applicationDidBecomeActive 的主体 if (myViewController != nil) { [myViewControl
我正在使用 UILocalNotification 对象开发闹钟应用程序。在我的代码中,当报警并且用户点击通知面板时,我的应用程序将显示另一个 View Controller 。为了满足这种情况,我在
我正在使用重复本地通知向用户显示警报。为此,我使用了下面的代码 UILocalNotification* localNotification = [[UILocalNotification alloc
这是我的第一个问题,因为我在开发我的第一个 iOS 应用程序时遇到了问题。它是数以千计的手电筒应用程序之一,但我正在尝试为其添加尽可能多的功能。其中之一是在应用程序进入后台或终止时保存应用程序的状态。
当我的应用进入后台时,出于数据保护的原因,它必须模糊当前屏幕。屏幕内容不能在任务管理器窗口中看到,因此必须在应用程序退出之前完成模糊例程。随着每次 UI 更新,模糊处理必须在主循环中进行。它只是在普通
当用户通过将应用程序切换到前台来激活应用程序时,我需要在屏幕上隐藏一些东西。 我已经尝试在 applicationDidBecomeActive 或 applicationWillEnterForeg
我在尝试实现 iOS-8 的新交互式通知时遇到了这个奇怪的问题。在处理本地通知时,一切都按预期工作,但在处理 APNS 时,一切都不太顺利。 详细信息:我通过横幅获得自定义推送(我只注册到最小上下文)
applicationDidBecomeActive 方法在应用程序激活时被调用,有没有办法可以为某个 UIViewController 执行此方法?我知道有用于 View Controller 的
当应用在后台收到远程推送通知时,应用进入applicationDidBecomeActive。从那里,如何从通知中访问数据的 NSDictionary? 最佳答案 通知数据在 application:
我是一名优秀的程序员,十分优秀!