Skip to content

Commit de99022

Browse files
committed
Fix Swift type casting for userInfo keys in iOS payload flattening
1 parent 5776a19 commit de99022

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ios/Classes/ForegroundNotificationHandler.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ class ForegroundNotificationHandler: NSObject, FlutterPlugin, UNUserNotification
3737
var flattenedData: [String: Any] = [:]
3838

3939
// Add all custom data (everything except "aps")
40-
for (key, value) in userInfo where key != "aps" {
41-
flattenedData[key] = value
40+
for (key, value) in userInfo {
41+
if let stringKey = key as? String, stringKey != "aps" {
42+
flattenedData[stringKey] = value
43+
}
4244
}
4345

4446
// Extract title/body from aps.alert

0 commit comments

Comments
 (0)