在iOS 13中,当用户在应用程序切换器中向上滑动我的应用程序时,会发生什么事件? [英] In iOS 13, what events do I get when the user swipes my app up in the app switcher?

查看:402
本文介绍了在iOS 13中,当用户在应用程序切换器中向上滑动我的应用程序时,会发生什么事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户在iOS 13的应用切换器中向上滑动我的应用时,我发现很难分类和说明发生(或没有得到)哪些事件,这似乎非常困难.这似乎是由于多场景支持.在那种情况下我会发生什么事情?

I'm finding it extraordinarily difficult to categorize and account for what events I get (or don't get) when the user swipes my app up in the app switcher on iOS 13. This seems to be because of changes caused by the multiple scene support. What are the events that I get in that situation?

推荐答案

让我们假设您的应用支持窗口场景.因此,用户在应用切换器中快速滑动的实际上是一个场景,而不是整个应用.那么可能性似乎如下.

Let's assume that your app supports window scenes. So what the user is swiping up in the app switcher is really a scene, not your app as a whole. Then the possibilities appear to be as follows.

如果场景位于最前面:

  • sceneDidEnterBackground
  • applicationWillTerminate(_:)
  • sceneDidEnterBackground
  • applicationWillTerminate(_:)

但是,如果场景不在最前面,您将一无所获;您已经收到sceneDidEnterBackground,并且由于该应用未运行,因此您现在不会获得applicationWillTerminate(_:).

But if the scene was not frontmost, you'll get nothing; you already received sceneDidEnterBackground, and you won't get applicationWillTerminate(_:) now because the app isn't running.

如果场景位于最前面:

  • sceneDidDisconnect(_:)
  • application(_:didDiscardSceneSessions:)
  • applicationWillTerminate(_:)
  • sceneDidDisconnect(_:)
  • application(_:didDiscardSceneSessions:)
  • applicationWillTerminate(_:)

但是,如果场景不在最前面,您将一无所获;您已经收到sceneDidEnterBackground,并且由于该应用未运行,因此您现在不会获得applicationWillTerminate(_:).

But if the scene was not frontmost, you'll get nothing; you already received sceneDidEnterBackground, and you won't get applicationWillTerminate(_:) now because the app isn't running.

如果场景位于最前面:

  • sceneDidEnterBackground
  • applicationWillTerminate(_:)(也许)
  • sceneDidEnterBackground
  • applicationWillTerminate(_:) (perhaps)

但是,如果场景不在最前面,您将一无所获;您已经收到sceneDidEnterBackground,并且由于应用程序未运行或应用程序未终止(如果有另一个窗口),现在不会获得applicationWillTerminate(_:).如果该应用程序仍在运行,则可能会显示sceneDidDisconnect(_:),并且稍后可能会显示application(_:didDiscardSceneSessions:).

But if the scene was not frontmost, you'll get nothing; you already received sceneDidEnterBackground, and you won't get applicationWillTerminate(_:) now because either the app isn't running or the app isn't terminating (if there's another window). If the app is still running, you might get sceneDidDisconnect(_:) and possibly application(_:didDiscardSceneSessions:) later.

这是什么奇怪的人?在iPad上运行的情况就是这样,我们支持场景,但有多个窗口.我们没有得到sceneDidEnterBackground!我认为这是不连贯的.由于我们不支持多个窗口,因此这基本上是一个iPhone应用程序,其行为应类似于iPhone应用程序.我不必因为我的应用程序同时在iPhone和iPad上运行而加倍代码.

What's the odd-man-out here? It's the case where we're running on an iPad and we support scenes but not multiple windows. We don't get sceneDidEnterBackground! I regard that as incoherent. Since we don't support multiple windows, this is basically an iPhone app and it should behave like an iPhone app. I shouldn't have to double up my code just because my app runs on both iPhone and iPad.

这篇关于在iOS 13中,当用户在应用程序切换器中向上滑动我的应用程序时,会发生什么事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆