Jelajahi Sumber

Fix 'Invalid type in JSON write (__NSDate)' after updating notification

Sebastián Katzer 10 tahun lalu
induk
melakukan
0157a9f450

+ 8 - 0
src/ios/APPLocalNotificationOptions.m

@@ -186,6 +186,14 @@ NSString* const DEFAULT_SOUND = @"res://platform_default";
  */
 - (NSDictionary*) userInfo
 {
+    if ([dict objectForKey:@"updatedAt"]) {
+        NSMutableDictionary* data = [dict mutableCopy];
+
+        [data removeObjectForKey:@"updatedAt"];
+
+        return data;
+    }
+
     return dict;
 }
 

+ 4 - 4
src/ios/UIApplication+APPLocalNotification.m

@@ -224,7 +224,7 @@
 
     for (UILocalNotification* notification in notifications)
     {
-        [options addObject:notification.userInfo];
+        [options addObject:notification.options.userInfo];
     }
 
     return options;
@@ -244,7 +244,7 @@
     for (UILocalNotification* notification in notifications)
     {
         if (notification.type == type) {
-            [options addObject:notification.userInfo];
+            [options addObject:notification.options.userInfo];
         }
     }
 
@@ -267,7 +267,7 @@
         notification = [self localNotificationWithId:id];
 
         if (notification) {
-            [options addObject:notification.userInfo];
+            [options addObject:notification.options.userInfo];
         }
     }
 
@@ -292,7 +292,7 @@
         notification = [self localNotificationWithId:id];
 
         if (notification && notification.type == type) {
-            [options addObject:notification.userInfo];
+            [options addObject:notification.options.userInfo];
         }
     }