adzerk / adzerk-ios-sdk

Access Adzerk's ad serving APIs via iOS
https://www.adzerk.com
Other
9 stars 5 forks source link

`PlacementDecision.Content.data` decoding fails if any of the values in the dictionary are null #53

Closed sukov closed 8 months ago

sukov commented 8 months ago

If there is a single key with null value in the "... { contents: { data: { customData: { key: null }}}}" response JSON, PlacementDecision will throw a decoding error and will try to use the fall back array decoding next which will also fail.

In order to fix the problem I think you should add something like this on AnyCodable before hitting the throw Decoding error.

else if let isValueNil = try? decodeNil(forKey: key), isValueNil == true {
    self = .null
}