objc

Instance Methods
<ApplicationDelegate> Protocol Reference

A protocol that defines the methods for an application delegate. More...

#import <Application/Application.h>

Instance Methods

(void) - applicationDidFinishLaunching:
 Called when the application has finished launching. More...
 
(void) - applicationWillTerminate:
 Called immediately before the application terminates. More...
 
(void) - applicationReceivedSignal:
 Called when the application receives a system signal. More...
 

Detailed Description

A protocol that defines the methods for an application delegate.

The ApplicationDelegate protocol provides a way for objects to receive notifications about application lifecycle events. Classes that conform to this protocol can be set as the application's delegate to handle these events.

Examples:
examples/Application/blink/main.m, examples/Application/gpio/main.m, examples/Application/helloworld/main.m, examples/Application/timer/main.m, examples/Network/ntp/main.m, and examples/Network/scan/main.m.

Definition at line 27 of file ApplicationDelegate+Protocol.h.

Method Documentation

◆ applicationDidFinishLaunching:()

- (void) applicationDidFinishLaunching: (id application
required

Called when the application has finished launching.

Parameters
applicationThe application instance that finished launching.

This method is called once during the application's lifecycle, after the application has completed its initialization and is ready to begin processing events. This is the appropriate place to perform any final setup or initialization that your application requires.

Note
This method is called from the main run loop thread.
The application's run loop will begin processing events after this method returns.

◆ applicationReceivedSignal:()

- (void) applicationReceivedSignal: (NXApplicationSignal signal
optional

Called when the application receives a system signal.

Parameters
signalThe type of signal that was received.

This method is invoked when the application receives system signals such as termination requests (SIGTERM), interrupt signals (SIGINT/Ctrl+C), or quit signals (SIGQUIT). Implement this method to handle signals gracefully by performing cleanup operations, saving state, or initiating shutdown procedures.

If this method is not implemented, the application will terminate with a -1 exit status when it receives a NXApplicationSignalTerm or NXApplicationSignalQuit signal. Other signals may be ignored.

In the future, this method may be called for power management events, such as low or empty battery conditions, or sleep conditions, allowing applications to respond appropriately to changes in power status.

Note
This method may be called from a signal handler context on some platforms. Keep the implementation simple and avoid blocking operations, memory allocation, or complex system calls.
See also
NXApplicationSignal for available signal types.

◆ applicationWillTerminate:()

- (void) applicationWillTerminate: (id application
optional

Called immediately before the application terminates.

Parameters
applicationThe application instance that is terminating.

This method is called just before the application actually terminates. Use this method to perform any final cleanup tasks.


The documentation for this protocol was generated from the following file: