Custom-URL-scheme icon indicating copy to clipboard operation
Custom-URL-scheme copied to clipboard

Seems to be broken on iOS 13

Open thomas-alrek opened this issue 6 years ago • 11 comments

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.

thomas-alrek avatar Oct 01 '19 11:10 thomas-alrek

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

NineSecurityPro avatar Oct 16 '19 14:10 NineSecurityPro

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

leo-buneev avatar Oct 21 '19 15:10 leo-buneev

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.

dwolner avatar Oct 29 '19 18:10 dwolner

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

allnash avatar Nov 08 '19 21:11 allnash

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.

kabaehr avatar Jan 06 '20 12:01 kabaehr

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);

assertdesignuk avatar Jan 30 '20 12:01 assertdesignuk

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

SailingSteve avatar Jul 24 '20 18:07 SailingSteve

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.

GexxOn avatar Jul 27 '20 15:07 GexxOn

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

cesar-oyarzun-m avatar Aug 06 '20 14:08 cesar-oyarzun-m

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

martijnmichel avatar Aug 01 '21 09:08 martijnmichel

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?

RickKock avatar Jul 26 '22 07:07 RickKock