EddyVerbruggen / Custom-URL-scheme

:link: Launch your Cordova/PhoneGap app by a Custom URL scheme like mycoolapp://
1.03k stars 365 forks source link

Seems to be broken on iOS 13 #306

Open thomas-alrek opened 4 years ago

thomas-alrek commented 4 years ago

Have anyone been able to get this to work under iOS 13?

The app does open when I open the custom scheme in Safari. But the handleOpenURL function never gets invoked.

This did work prior to iOS 13.

NineSecurityPro commented 4 years ago

I got the same situation... what's wrong?

leo-buneev commented 4 years ago

Works just fine for me on iOS13. Make sure you define window.handleOpenURL ASAP - even before cordova onDeviceReady

dwolner commented 4 years ago

Is the index.html before deviceReady enough? Still not working for me, even when emulating iOS 12.4 or on my devices iOS 13 devices.

allnash commented 4 years ago

Works for me on 13.2.1 Make sure to put the function on the DOM window object.

kabaehr commented 4 years ago

Anyone solved this yet? I have the impression it is not a iOS 13 but XCode 11 issue. Since our app build from Jenkins with an older XCode version works just fine.

assertdesignuk commented 4 years ago

Okay this works for me on iOS 13 from cold start and from resume.

Both of these are in a bare JS file included in the footer of the app. I have a 100% success rate with the below.

// This always fires but the app may not be fully loaded at times, so we store the url in 
// localstorage rather than open the resource(must be attached to window object as below.
//  It then attempts to open the resource
window.handleOpenURL = function(url) {

    localStorage.setItem('share_url', url);
    open_url(localStorage.getItem('share_url'));
};

// we run a timeout delay with 1 second which open the url from localstorage just in case the previous attempt in the  above function did not work.
setTimeout(function() {
    open_url(localStorage.getItem('share_url'));
}, 1000);
SailingSteve commented 3 years ago

I got this working for my wevotetwitterscheme:// in my WeVoteCordova app by

  1. Making sure that the window.handleOpenURL was defined before the deviceready event is handled in the index.js
  2. Going into Xcode and adding a "URL Schemes" entry for wevotetwitterscheme in WeVoteCordova-info.plist
    See the screen shot: Screen Shot 2020-07-24 at 11 35 32 AM
GexxOn commented 3 years ago

In my case the function openURL (AppDelegate.m) was overwritten by an other plugin (cordova-plugin-facebook4). So check out if some of your plugins using openURL. Copying the code from CDVAppDelegate.m openURL function into the AppDelegate.m fixed my problem.

cesar-oyarzun-m commented 3 years ago

I'm runing Xcode 11.3.1 and IOS 13.3 and I tried adding

window.handleOpenURL = function (url) {
setTimeout(function() {
alert("received url: " + url);
}, 0);
};

in my index.js before device start and also in another js and it doesn't get trigger on IOS is working for android but not for IOS. Anyone having similar issue

martijnmichel commented 2 years ago

same here, handleOpenURL is not called on iOS... :/

rickkock commented 1 year ago

I have the same issue, can't get is working on iOS. but after reviewing the code, there isn't any code for iOS in this plugin. Not even in the www folder. How does the app know how to call handleOpenURL at all?