Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

applicationDidFinishLaunching not invoked

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 !

like image 721
Laurent Crivello Avatar asked Oct 27 '11 19:10

Laurent Crivello


2 Answers

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.

like image 100
Joshua Nozzi Avatar answered Sep 25 '22 15:09

Joshua Nozzi


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.

like image 20
original_username Avatar answered Sep 22 '22 15:09

original_username