applicationDidFinishLaunching 未调用

发布于 2024-12-12 02:00:29 字数 162 浏览 0 评论 0原文

在我的 appdelegate.m 中,未调用 applicationDidFinishLaunching 。 我读到这是由于我的“应用程序”的委托未正确连接,但我不知道如何连接它。我所做的就是右键单击 XIB 文件中的应用程序,然后将委托出口拖到某处......但不知道在哪里。 任何帮助表示赞赏。 谢谢 !

In my appdelegate.m, the applicationDidFinishLaunching is not invoked.
I have read that this is due to the fact my "Application"'s delegate is not properly connected, but I don't know how to connect it. What I do is right-clicking on Application from the XIB file, and drag the delegate outlet somewhere... but don't know where.
Any help appreciated.
Thanks !

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

嘦怹 2024-12-19 02:00:29

在 MainMenu.xib 中,确保存在 AppDelegate 类的实例。要制作一个,请将一个普通对象(蓝色立方体)拖到列表中,并将其类名称设置为 AppDelegate(或任何您的应用程序委托类名称)。

同样在 MainMenu.xib 中,要连接它,请将连接从 Application 对象拖到您的 AppDelegate 实例(蓝色立方体)并将其连接到委托出口。

完毕。

In your MainMenu.xib, make sure there's an instance of your AppDelegate class. To make one, drag a plain object (blue cube) into the list and set its class name to AppDelegate (or whatever your app delegate class name is).

Also in the MainMenu.xib, to connect it, drag a connection from the Application object to your AppDelegate instance (the blue cube) and connect it to the delegate outlet.

Done.

司马昭之心 2024-12-19 02:00:29

如果您已更新到 Swift 3,可以尝试以下操作:

看一下“AppDelegate.swift”并确保相关行如下所示:

func applicationDidFinishLaunching(_ aNotification: Notification) {

与此相反:

func applicationDidFinishLaunching(_ aNotification: NSNotification) {

我刚刚更新了一个应用程序,并且没想到查看。结果是我的应用程序启动了,但相关方法从未被调用。显然,您应该检查是否有其他接受通知对象的函数。

Here's something to try if you've updated to Swift 3:

Take a peek at your "AppDelegate.swift" and make sure the relevant line looks like this:

func applicationDidFinishLaunching(_ aNotification: Notification) {

as opposed to this:

func applicationDidFinishLaunching(_ aNotification: NSNotification) {

I just updated an app, and didn't think to check. The result was that my app launched, but the relevant method was never called. Obviously, you should then check for other functions you have that take Notification objects.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文