Instance Method

handleActionWithIdentifier:forLocalNotification:

Delivers a local notification payload and a user-selected action to the app.

Declaration

- (void)handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(UILocalNotification *)localNotification;

Parameters

identifier

The action selected by the user. The string is the identifier for an action that was registered by the companion iOS app; it identifies which button was tapped by the user. Use the identifier to perform the associated action. This parameter is set to the empty string when the user launches the app without tapping one of the action buttons.

localNotification

The local notification object that triggered the notification.

Discussion

Use this method to handle actions selected by users from your notification interfaces. If your containing iOS app supports interactive notifications, the identifier parameter may contain the action identifier for the button that was tapped. Use that value to perform the requested action. If the identifier parameter contains an empty string, that means the user launched your Watch app from the notification interface without choosing a specific action.

The system calls this method on your WatchKit extension’s main thread. The super implementation of this method does nothing.

For information about how to support interactive notifications in your iOS app, see Local and Remote Notification Programming Guide. For information about how to display a custom interface for notifications, see App Programming Guide for watchOS.

See Also

Deprecated Methods

- didReceiveRemoteNotification:

Tells the delegate that a remote notification arrived.

Deprecated
- didReceiveLocalNotification:

Tells the delegate that a local notification was triggered.

Deprecated
- handleActionWithIdentifier:forRemoteNotification:

Delivers a remote notification payload and a user-selected action to the app.

Deprecated
- handleActionWithIdentifier:forRemoteNotification:withResponseInfo:

Delivers a remote notification payload and user response information to the app.

Deprecated
- handleActionWithIdentifier:forLocalNotification:withResponseInfo:

Delivers a local notification payload and user response information to the app.

Deprecated