Hello,
We created a sample app delegate to test whether applicationDidFinishLaunching runs as expected or not (code as follows). The observed behavior was that the executable
prints both applicationWillFinishLaunching and applicationDidFinishLaunching in the case when we're using an RDP connection to the mac
prints only applicationWillFinishLaunching in case of ssh connection to the mac
Why is this behavior different and how can I ensure it runs correctly with ssh? Kindly help.
#include <unistd.h>
#include <sys/types.h>
#include <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <SystemConfiguration/SCDynamicStore.h>
@interface TWAppKitAppDelegate : NSObject <NSApplicationDelegate>
@end
@implementation TWAppKitAppDelegate
// Launching Applications
- (void)
applicationWillFinishLaunching: (NSNotification *) pNotification
{
NSLog(@"applicationWillFinishLaunching");
}
- (void)
applicationDidFinishLaunching: (NSNotification *) pNotification
{
NSLog(@"applicationDidFinishLaunching");
}
// Managing Active Status
- (void)
applicationWillBecomeActive: (NSNotification *) pNotification
{
}
- (void)
applicationDidBecomeActive: (NSNotification *) pNotification
{
}
- (void)
applicationWillResignActive: (NSNotification *) pNotification
{
}
- (void)
applicationDidResignActive: (NSNotification *) pNotification
{
}
// Terminating Applications
#if 0
- (NSApplicationTerminateReply)
applicationShouldTerminate:(NSNotification *) pNotification
{
return NSApplicationTerminateReply::NSTerminateNow;
}
#endif
- (BOOL)
applicationShouldTerminateAfterLastWindowClosed:(NSNotification *) pNotification
{
return NO;
}
- (void)
applicationWillTerminate:(NSNotification *) pNotification
{
}
- (BOOL)
application:(NSApplication *) pSender
openFile: (NSString *) pFileName
{
return YES;
}
- (void)
application:(NSApplication *) pSender
openFiles: (NSArray<NSString *> *) pFileNames
{
}
@end
int
main (int pArgc, char ** pArgv)
{
NSApplication * app;
TWAppKitAppDelegate * appdelegate;
app = [NSApplication sharedApplication];
appdelegate = [[TWAppKitAppDelegate alloc] init];
[app setDelegate:appdelegate];
[NSApp run]; //NOTE: Apple never 'returns' from here
NSLog(@"Function main called \n");
return 0;
}
1
0
1.3k