Skip to content

ios: Check we're on the main thread before opening URL#98

Closed
madsmtm wants to merge 2 commits intoamodm:mainfrom
madsmtm:ios-main-thread
Closed

ios: Check we're on the main thread before opening URL#98
madsmtm wants to merge 2 commits intoamodm:mainfrom
madsmtm:ios-main-thread

Conversation

@madsmtm
Copy link
Copy Markdown
Contributor

@madsmtm madsmtm commented Mar 9, 2025

-[UIApplication openURL:options:completionHandler:] is not safe to use from a thread that is not the main thread, since UIApplication is marked as NS_SWIFT_UI_ACTOR in the header, and the method is not marked with NS_SWIFT_NONISOLATED (unlike e.g. canOpenURL:, which is also explicitly documented to be usable from off the main thread).

See also discussion in #95, this check is present in objc2-ui-kit.

Builds upon #97 to avoid a merge conflict.

madsmtm added 2 commits March 9, 2025 20:15
`-[UIApplication openURL:options:completionHandler:]` is not safe to use
from a thread that is not the main thread, since `UIApplication` is
marked as `NS_SWIFT_UI_ACTOR` in the header, and the method is not
marked with `NS_SWIFT_NONISOLATED` (unlike e.g. `canOpenURL:`).
@amodm
Copy link
Copy Markdown
Owner

amodm commented Mar 10, 2025

Using #95 over this.

@amodm amodm closed this Mar 10, 2025
@madsmtm madsmtm deleted the ios-main-thread branch February 20, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants