tinode / ios

Tinodios: Tinode Messaging Client for iOS
Apache License 2.0
243 stars 107 forks source link

<head> missing in MessageDb #129

Closed YKuvonchbek closed 4 years ago

YKuvonchbek commented 4 years ago

Head values missing in this line: https://github.com/tinode/ios/blob/devel/TinodiosDB/MessageDb.swift#L209 I think Tinode.deserializeObject(from: r[self.head]) eqalizing JSON object to nill.

YKuvonchbek commented 4 years ago

I suppose, exactly at this line: https://github.com/tinode/ios/blob/devel/TinodeSDK/Tinode.swift#L1207 d value equalized non nil value for head.

YKuvonchbek commented 4 years ago

Actually, the problem is in parts[0] == String(describing: T.self) debugger shows that parts[0] = Optional<Dictionary<String, JSONValue> and String(describing: T.self)) = Dictionary<String, JSONValue> that is why it is returning nil value.

aforge commented 4 years ago

So it writes the type as Optional during serialization which is not good.

aforge commented 4 years ago

I think this should take care of it: https://github.com/tinode/ios/commit/fbd4a06306674d84b65ea3f379805a7a6348ae6f