RaphaelWoude/capacitor-native-settings

UIApplication.shared.canOpenURL should be used from main thread

Closed this issue · 2 comments

leye0 commented

I received this warning...

UI API called from background thread: UIApplication.canOpenURL(_:) must be used from main thread only

...when navigating back to my application.

It seems like the main thread should be retrieved before calling the UIApplication.shared.canOpenURL method. Maybe something like this would help?

DispatchQueue.main.async {
    UIApplication.shared.open(settingsUrl, completionHandler: { (success) in
        call.resolve([
            "status": success
        ])
    });
}

image

Thanks

That should do the trick. Would you be able to make a pull request for this? @leye0

Here's a PR: #12