Skip to content

Commit 9f70b4e

Browse files
committed
fix casting causing payload gets to always be nil
1 parent 69960f0 commit 9f70b4e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

swift-sdk/Internal/IterableKeychain.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ class IterableKeychain {
105105
return nil
106106
}
107107

108-
return (payload: lastPushPayloadJSON, expiration: payloadExpirationPair.expiration) as? (payload: Data, expiration: Date?)
108+
guard let lastPushPayloadData = try? JSONSerialization.data(withJSONObject: lastPushPayloadJSON) else {
109+
return nil
110+
}
111+
112+
return (payload: lastPushPayloadData, expiration: payloadExpirationPair.expiration)
109113
}
110114

111115
private func savePayloadExpirationPairToKeychain(payload: [AnyHashable: Any]?, expiration: Date?) {

0 commit comments

Comments
 (0)