apache / cordova-ios

Apache Cordova iOS
https://cordova.apache.org/
Apache License 2.0
2.16k stars 990 forks source link

Background push notifications isn't working as expected #1270

Closed yokeshchronus closed 1 year ago

yokeshchronus commented 1 year ago

Bug Report

Whenever I click on push notifications when app is not in background, it is not getting redirected properly. 

Problem

        Getting an error "Failed to load web page with error , The operation couldn't be completed. NSURLDomain error -999"

What is expected to happen?

        App is expected to take the corresponding page of push notification but throws this error instead and shows the error page of cordova.

Information

On debugging found out there was some problem in window.location.href = "requiredurltoopen" , this is the line failing and throwing such issues. The same works well in android and older cordova ios version. Would like to know what should we do to avoid such issue?

Command or Code

window.location.href = "requiredurltoopen" when app is not in background

Environment, Platform, Device

Problem is in all ios phones

Version information

Checklist

breautek commented 1 year ago

Error -999 is an cancel error.

It means the webview canceled/aborted loading the document. I think this generally happens when the webview is instructed to load a document when a document load is already in progress, but I'm not sure if there are other situations where a cancel error will be thrown.

yokeshchronus commented 1 year ago

Can we prevent that in any way ?

breautek commented 1 year ago

Can we prevent that in any way ?

I think we need to determine why the document is being cancelled in the first place before that question can be answered.

jcesarmobile commented 1 year ago

cordova-ios has no push notification code and the navigation on push click must be some plugin code or your own code, so closing as not a cordova-ios bug.