GetStream / stream-swift

Swift client for Stream API
https://getstream.io
BSD 3-Clause "New" or "Revised" License
35 stars 26 forks source link

Weird issue in getting data using timeline.get feedslug #10

Closed mrazam110 closed 5 years ago

mrazam110 commented 5 years ago

What did you do?

Running the app without breakpoints

What did you expect to happen?

It should respond be in closure

What happened instead?

It's not even coming in closure

GetStream Environment

GetStream version: Xcode version: Swift version: Platform(s) running GetStream: macOS version running Xcode:

Additional context

I am getting a weird issue, if I run by adding breakpoint and print the slug and continue running the project it works fine, but if I am running project without breakpoints, getstream is not responding in their callback or doing anything, I tried implementing delays but no use

code:

Client.config = .init(apiKey: GET_STREAM_API_KEY, appId: GET_STREAM_APP_ID, token: timelineToken)
let timeline = Client.shared.flatFeed(feedSlug: "timeline", userId: userId)
timeline.get(typeOf: ReviewActivity.self) { [weak self] (response) in
    print(response)
}
buh commented 5 years ago

Hey @mrazam110! Probably your timeline feed was deallocated. Can you try to make it as an instance variable?

mrazam110 commented 5 years ago

Hey @mrazam110! Probably your timeline feed was deallocated. Can you try to make it as an instance variable?

I tried implementing like

timelineCancellable = timeline.get(typeOf: ReviewActivity.self) { [weak self] (response) in
}

same issue

mrazam110 commented 5 years ago
timelineFeed = Client.shared.flatFeed(feedSlug: "timeline", userId: userId)

By doing this. Works fine. Thanks