Closed Parithi closed 4 years ago
Found the solution, went through the code and found that self
becomes nil when the methods are called from the local scope. Creating a strong reference to the feed or activity fixed the issue.
class ViewController {
var userFeed : FlatFeed! // create strong reference
var activity : Activity! // create strong reference
override func viewDidLoad() {
super.viewDidLoad()
userFeed = Client.shared.flatFeed(feedSlug: "FLAT_FEED_ID", userId: "LOGGED_USER_ID")
activity = Activity(actor: User.current!, verb: "pin", object: "Place:72482734")
userFeed.add(activity) { [weak self] result in
if let activity = try? result.get() {
print(activity.id)
} else {
print("FAILED")
}
}
userFeed.get() { [weak self] result in
print(result)
}
}
}
Thank you @Parithi had the same problem and you saved me tons of time in debugging!
What did you do?
Integrated GetStream to Xcode Project
Initialized GetStream on AppDelegate :
On the ViewController, trying to fetch the activities from a feed (which have activities inside)
What did you expect to happen?
What happened instead?
However, since I have the
logsEnabled
totrue
, I'm able to see the raw JSON values in the Xcode Console with all my activities from that feed. The activities are successfully posted to the feed but the closures are just not called.GetStream Environment
GetStream version: 2.2.2 Xcode version: 11.5 Swift version: 5 Platform(s) running GetStream: iOS 13.5 macOS version running Xcode: macOS 10.15.4
Additional context
I've also tried removing all the pods and installing GetStream using
pod 'GetStream'
instead of version 2.2.2, but I have the same issue even on a fresh install.