Reputation: 2111
I am using NS 8.6 (vanilla) on iOS 18.0. The issue happens on both, simulator and physical device. Here is my code:
import { Utils } from "@nativescript/core";
...
public navigateToUrl(url: string) {
const opened: boolean = Utils.openUrl(url);
}
When calling the above function, 'opened' is always false and nothing happens.
I tried with different, valid urls with no success.
Is this related to the new iOS 18 or something broke in NS 8.6?
If it is iOS 18 issue, do we have a workaround? The Apple testers are all using the 18 and they will keep rejecting our app, until we fix that.
Upvotes: 0
Views: 143
Reputation: 2111
For those of you still struggling with this. I was able to make this work with the help of @jorge_mendes#007 from the Discort community. He suggested the following approach and I can confirm that this works.
import { dataSerialize } from "@nativescript/core/utils";
...
public navigateToURLiOS(url: string) {
const nsUrl = NSURL.URLWithString(url.trim());
UIApplication.sharedApplication.openURLOptionsCompletionHandler(
nsUrl,
dataSerialize({}),
() => { }
);
}
Hope this saves you some research time.
Upvotes: 0