gpt4 book ai didi

objective-c - 在 applicationDidBecomeActive 中捕获 launchOptions

转载 作者:行者123 更新时间:2023-11-28 19:13:38 25 4
gpt4 key购买 nike

我想在 didFinishLaunchingWithOptions 中捕获 launchOptions,但在 applicationDidBecomeActive 中(当我的应用获得焦点时)。例如,我在 Box 中打开一个文档。然后,我选择“打开方式”并选择我的应用程序。然后我的应用获得焦点。

如何在我的 UIApplicationDelegate 中恢复 launchOptions

谢谢

最佳答案

如果您的应用程序未运行并且通过其他应用程序打开,则会调用 applicationDidBecomeActive 并且您可以访问 launchOptions。该应用随后将调用 application:openURL:sourceApplication:annotation:

但是,如果您的应用程序处于后台并且只是处于事件状态,则只会调用 application:openURL:sourceApplication:annotation:,因此您不会获得任何 launchOptions。您应该能够从 application:openURL:sourceApplication:annotation: 的参数中获得所需的所有详细信息。

来自 application:openURL:sourceApplication:annotation: 的完整详细信息文档:

If an application is launched as a result of another application requesting it to open a URL resource, UIApplication first sends the application a application:didFinishLaunchingWithOptions: message and then it invokes this method. This method supplies the delegate of the handling application with the bundle ID of the source application as well as any annotation information from that application. If an application is already running when it receives a request to open a URL, this method is called but application:didFinishLaunchingWithOptions: isn’t.

关于objective-c - 在 applicationDidBecomeActive 中捕获 launchOptions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13603218/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com