Skip to content
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

iOS does not open URLs #6154

Closed
1 task done
konguele opened this issue Jan 8, 2024 · 5 comments · Fixed by #6384
Closed
1 task done

iOS does not open URLs #6154

konguele opened this issue Jan 8, 2024 · 5 comments · Fixed by #6384

Comments

@konguele
Copy link

konguele commented Jan 8, 2024

Is there an existing issue for this?

Describe the bug

Good Morning,

I've noticed that when I publish my app on iOS, it can't open the links. I have social media links (to try to open the app or the browser) and links that require the browser because it is a website.

Apparently they don't work for iOS and there aren't many options to open the links. Does the URL have to contain a specific format?

Captura de pantalla 2024-01-08 083213 Captura de pantalla 2024-01-08 083301

Thank you for your help.

Steps to reproduce

Click on an image and access to the URL. Only doesn't work for iOS

GDevelop platform

Mobile

GDevelop version

5.3.186

Platform info

OS (e.g. Windows, Linux, macOS, Android, iOS)

OS Version (e.g. Windows 10, macOS 10.15)

Browser(For Web) (e.g. Chrome, Firefox, Safari)

Device(For Mobile) (e.g. iPhone 12, Samsung Galaxy S21)

Additional context

No response

@ClementPasteau
Copy link
Collaborator

This is the code being used to open URLs in this action.
https://github.com/4ian/GDevelop/blob/master/GDJS/Runtime/pixi-renderers/runtimegame-pixi-renderer.ts#L853-L867

It is possible the combination of ios/cordova makes window.open() not work as expected (I've seen other complain on the web about this, possibly linked to a native ios popup blocker)

I don't have a solution for this though as it's quite specific and cumbersome to test, you may need to experiment using custom JS events and try different ways of opening a URL until you find one that works.

@josephspagnuolo
Copy link
Contributor

I am currently facing the same issue. Do you have any update on this or any workarounds you have used? @konguele

@konguele
Copy link
Author

konguele commented Feb 25, 2024

Hello @josephspagnuolo ,

For mi it's solved. I'll explain step by step what I'm doing:

1- In the config.xml file I add the cordova-plugin-inappbrowser plugin:

<plugin name="cordova-plugin-inappbrowser" spec="6.0.0">
</plugin>

2- In Xcode I modify the code in the files code0 www and code0 staging.
a) I deleted the old code:

if (isConditionTrue_0) {
{gdjs.evtTools.window.openURL("https://www.instagram.com/stiluproject/", runtimeScene);
}}

b) I added this code:

if (isConditionTrue_0) {
        var url = "https://www.instagram.com/stiluproject/";
        if (typeof window.cordova !== "undefined") {
            var target = "_system";
            var options = "location=yes";
            cordova.InAppBrowser.open(url, target, options);
        } else {
            window.open(url, "_blank");
        }
    }

@josephspagnuolo
Copy link
Contributor

Great stuff man!!!!! This worked for me thanks a lot. I also had to run cordova build to install the plugin. @konguele

@konguele
Copy link
Author

konguele commented Feb 26, 2024

@josephspagnuolo I'm glad it worked for you! Since we are exchanging information, it has nothing to do with this problem, but you wouldn't happen to be working with the IAP extension, would you? I need help with that.

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 a pull request may close this issue.

3 participants