IOS 9+ Push notification with text input does not call handleActionWithIdentifier: forRemoteNotification: withResponseInfo:

In short: I can add custom text input fields to respond to a push notification. I just can't get the associated application to delegate in order to actually process the input from the user.

I have two custom actions: acceptAction(a simple actionable action) and replyAction(one with a behavior UIUserNotificationActionBehaviorTextInput) added to a custom one UIMutableUserNotificationCategoryand this category added to mine UIUserNotificationSettings. All notifications are triggered properly. All buttons are displayed as UIUserNotificationTypeAlert.

While it acceptActionworks

- (void)application:(UIApplication *)application handleActionWithIdentifier:(nullable NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo withResponseInfo:(NSDictionary *)responseInfo completionHandler:(void(^)())completionHandler

and i cant run replyAction. I can see the text box, enter the data, click "Submit", but after that there will be no effect. I really want to capture this input text with UIUserNotificationActionResponseTypedTextKey.

What am I missing?

Additional information: Although I have no idea why, if I also implement the basic

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo

along with another method, I see that it replyActionlaunches this and not the other, but acceptActiononly the first method launches.

I have also correctly set the background settings in the application.

+4
source share
1 answer

Instead, you should implement the following method.

-(void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(UILocalNotification *)notification withResponseInfo:(NSDictionary *)responseInfo completionHandler:(void (^)())completionHandler


The dictionary responseInfocontains a key UIUserNotificationActionResponseTypedTextKeywith a text response entered by the user.

0

Source: https://habr.com/ru/post/1628986/


All Articles