How to use UIApplication.shared.open in reducer? #2441
-
I am trying to create a location permission flow. I have a button which shows up if the user has denied location permission. They can click on the button and the action is sent to the reducer. Some checks are made to see if we can show the location permission modal or not. If we can't then using However, running return .run { send in
await openUrl(URL(string: UIApplication.openSettingsURLString)!)
} This results in a runTImeWarning for TCA ViewStore.send" was called on a non-main thread with...
I am able to move Task { @MainActor in
UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!)
} Any ideas will be helpful. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The If you expand the warning in the left sidebar of Xcode it will show you a stack trace of where the the |
Beta Was this translation helpful? Give feedback.
The
.run
effect you posted above is the correct way to do this, and it cannot cause the runtime warning you showed. That warning only occurs when sending an action directly to a view store, which effects do not do. So there must be something else going on.If you expand the warning in the left sidebar of Xcode it will show you a stack trace of where the the
viewStore.send
happened that caused the warning. Maybe that will help you track down what happened.