gpt4 book ai didi

ios - `applicationDidFinishLaunching` 未在 iOS 项目中调用

转载 作者:行者123 更新时间:2023-12-01 19:48:19 25 4
gpt4 key购买 nike

applicationDidFinishLaunching尽管 applicationDidBecomeActive叫做。我只能找到 macOS 解决此问题的方法( hereherehere )

在我的 info.plist文件,我正确设置了主 Storyboard文件基本名称。我有一个 Storyboard 入口点连接到我的初始 View Controller 。应用程序启动,我看到了我应该看到的一切,但是 applicationDidFinishLaunching永远不会被调用,我使用该方法来处理启动配置和构造。

根据 macOS 帖子,我尝试将对象(黄色立方体)拖到初始 View Controller 的 IB 层次结构中,将其类设置为我的应用程序委托(delegate)类,并将其设置为初始 View Controller 的委托(delegate)。但是applicationDidFinishLaunching仍然从未被调用。

方法签名是正确的(我知道这是 Swift 项目的常见问题)

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
return YES;
}


- (void)applicationDidFinishLaunching:(UIApplication *)application{
//code
}

最佳答案

applicationDidFinishLaunching: 的文档中它说:

Although not formally deprecated, do not use this method in your apps. Use the application:willFinishLaunchingWithOptions: and application:didFinishLaunchingWithOptions: methods instead.



如果您使用 application:didFinishLaunchingWithOptions:然后 applicationDidFinishLaunching:不会被调用。

关于ios - `applicationDidFinishLaunching` 未在 iOS 项目中调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47316757/

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