From 0c21b4bda1062396513d1ad2efe9116cfdf78729 Mon Sep 17 00:00:00 2001 From: yogevbd Date: Thu, 18 Apr 2019 15:11:24 +0300 Subject: [PATCH] Fix unrecognized selector crash on UNNotification cast --- RNNotifications/RNNotifications.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/RNNotifications/RNNotifications.m b/RNNotifications/RNNotifications.m index cafa406..f74840d 100644 --- a/RNNotifications/RNNotifications.m +++ b/RNNotifications/RNNotifications.m @@ -247,9 +247,11 @@ RCT_EXPORT_MODULE() NSMutableDictionary* info = [[NSMutableDictionary alloc] initWithDictionary:@{ @"identifier": identifier, @"completionKey": completionKey }]; // add text - NSString* text = ((UNTextInputNotificationResponse*)response).userText;//[response objectForKey:UIUserNotificationActionResponseTypedTextKey]; - if (text != NULL) { - info[@"text"] = text; + if ([response isKindOfClass:[UNTextInputNotificationResponse class]]) { + NSString* text = ((UNTextInputNotificationResponse*)response).userText; + if (text != NULL) { + info[@"text"] = text; + } } NSDictionary* userInfo = response.notification.request.content.userInfo; -- 2.26.2