Closed rissicay closed 4 years ago
When I use the javascript library, getting the feed works fine.
const feedClient = stream.connect(apiKey, apiSecret, apiId)
const random = feedClient.feed('timeline', userId);
// Add an Activity; message is a custom field - tip: you can add unlimited custom fields!
(async () => {
try {
const res = await random.get({ limit: 10 })
console.log(res);
} catch (e) {
// Deal with the fact the chain failed
}
})();
Hi @rissicay
try!
into do { try ... } catch { print(error) }
and print the error.Client.config = .init(apiKey: "<#ApiKey#>", appId: "<#AppId#>", logsEnabled: true)
FeedItem
as EnrichedActivity<User, String, DefaultReaction>
which mean you need to enrich your activity FeedItem
with a user, so I think you can try this:
timeline.get(typeOf: FeedItem.self, pagination: .limit(50)) { ... } // `enrich` is true by default
I think you can quickly find the issue if you'll check JSON in logs and compare it with decoding error.
i found the issue. This fixed it:
final public class FeedItem : EnrichedActivity<String, String, DefaultReaction> {
So yes, user was the issue (we store user in our database). Thanks for the log tip.
I am trying to fetch the activity feed with the below code:
My FeedItem class looks like:
The error I am getting:
Fatal error: 'try!' expression unexpectedly raised an error: JSON decoding error: The data couldn’t be read because it isn’t in the correct format.. Data: 39648 bytes: file
GetStream version: 2.2.3 Xcode version: 11.6 Swift version: 5