-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SwiftUI - Publishing changes from background threads is not allowed #8132
Comments
Hi @sonisan thanks for reporting this. We will investigate the issue. |
@sonisan where are you attaching the publisher? Can you show us the code where you install the |
Thanks @leemaguire . From var body: some View {
switch (deeplinkTarget) {
case .home:
if let currentRealmUser = app.currentUser {
let configuration = currentRealmUser.flexibleSyncConfiguration()
OpenSyncedRealmView(currentRealmUser: currentRealmUser)
.environment(\.realmConfiguration, configuration)
}
...
}
...
}
... leading to: struct OpenSyncedRealmView: View {
@ObservedObject var currentRealmUser: RealmSwift.User
@ObservedResults(User.self) var users
...
var body: some View {
if let userId = ...,
let currentUser = ... {
// show main views
...
} else {
// add subscriptions
...
}
...
}
} |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
How frequently does the bug occur?
Sometimes
Description
I am building an iOS app using SwiftUI and Realm flexible sync. When launching the app with a user logged in, the following warning (twice the same, actually) at runtime sometimes appears:
from the Sync file on line:
located in {{public class UserPublisher: Publisher }}
I am not getting this warning all the time, but from the below stacktrace it seems to be related to the user's token refresh. The stacktrace does not pinpoint to a specific place in my own code so I am not sure if that's an issue coming from my app or the SDK.
Stacktrace & log output
Can you reproduce the bug?
Sometimes
Reproduction Steps
No reproduction steps have been found yet. But it appears once after a while, coinciding with the SDK refreshing the user token.
Version
10.35.0
What Atlas Services are you using?
Both Atlas Device Sync and Atlas App Services
Are you using encryption?
No
Platform OS and version(s)
iOS 16.2, 16.3
Build environment
Xcode version: 14.2
The text was updated successfully, but these errors were encountered: