capacitor-inappbrowser icon indicating copy to clipboard operation
capacitor-inappbrowser copied to clipboard

Question: Following deep links in iOS using openWebView : how ?

Open alainkr opened this issue 1 year ago • 6 comments

Hello

I can't get to open deeplink using openWebView in iOS. It's working fine with Android. Am I missing something ? Thanks for your help.

alainkr avatar Jan 06 '25 11:01 alainkr

openWebView seems to be a hot mess at moment.

KkatieJ avatar Jan 06 '25 15:01 KkatieJ

Same problem here on capgo v. 6.9.18.

Related issue: #243

I cannot use deep links in iOS browser - in android it works. F.e. when inserting a button and when clicking on it, it should open the deep link.

I get following error then:

#FactoryInstall Unable to query results, error: 5

0x10f06c820 - [pageProxyID=51, webPageID=96, PID=1426, navigationID=95] ProvisionalPageProxy::didFailProvisionalLoadForFrame: frameID=97

0x1046e2a18 - [pageProxyID=51, webPageID=67, PID=1425] WebPageProxy::didFailProvisionalLoadForFrame: frameID=97, isMainFrame=1, domain=NSURLErrorDomain, code=-1002, isMainFrame=1, willInternallyHandleFailure=0

Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "((target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.rendering AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.networking AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.webcontent))" UserInfo={NSLocalizedFailureReason=((target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.rendering AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.networking AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.webcontent))}>

Failed to terminate process: Error Domain=com.apple.extensionKit.errorDomain Code=18 "(null)" UserInfo={NSUnderlyingError=0x301991f50 {Error Domain=RBSRequestErrorDomain Code=3 "No such process found" UserInfo={NSLocalizedFailureReason=No such process found}}}

0x10f070d80 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=1426, error: (null)

Failed to terminate process: Error Domain=com.apple.extensionKit.errorDomain Code=18 "(null)" UserInfo={NSUnderlyingError=0x30192f240 {Error Domain=RBSRequestErrorDomain Code=3 "No such process found" UserInfo={NSLocalizedFailureReason=No such process found}}}

Tried to create a app.entitlement file in Xcode (under main folder "App") and link it in the "build settings" - "Code Signing Entitlements".

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
    "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.developer.web-browser-engine.rendering</key>
    <true/>
    <key>com.apple.developer.web-browser-engine.networking</key>
    <true/>
    <key>com.apple.developer.web-browser-engine.webcontent</key>
    <true/>
</dict>
</plist>

But now the capabilities & signing profiles do not work anymore and in apple certification portal custom entitlements cannot be added (or a request to apple is needed). I assume this is not the right approach?!

Anyone managed to get this working? @alainkr @KkatieJ ?

MarcelSchuermann avatar Jan 18 '25 14:01 MarcelSchuermann

Same as here: https://github.com/Cap-go/capacitor-inappbrowser/issues/243 please provide a reproduction then i will fix it

riderx avatar Feb 01 '25 02:02 riderx

@riderx Here's a simple app that opens a webview to a website where deep links can be tested: https://github.com/Randati/capgo-deeplink/

Relevant code is just:

InAppBrowser.openWebView({ url: "https://app.urlgeni.us/deeplink-tester" });

On the website, trying to open for example whatsapp://send opens WhatsApp on Android, but not on iOS.

Adding "whatsapp" to UrlsHandledByApp.schemes list in https://github.com/Cap-go/capacitor-inappbrowser/blob/7.2.20/ios/Plugin/WKWebViewController.swift#L18 does fix the problem, so I imagine that handleURLWithApp needs changing. Android seems to try to open all non http(s) schemes in another app (https://github.com/Cap-go/capacitor-inappbrowser/blob/7.2.20/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewDialog.java#L733)

On iOS the schemes that you want to be able to handle needs to be added to LSApplicationQueriesSchemes as well. https://github.com/Randati/capgo-deeplink/blob/master/ios/App/App/Info.plist#L48-L53

Randati avatar Mar 06 '25 09:03 Randati

We are running into the same issue. For example TWINT a popular payment method in Switzerland requires us to open twint-extended and twint-issuer schemes. On Android that works fine, but on iOS as Randati said before me we need to add the schemes to the handler inside the inapp browser and to LSApplicationQueriesSchemes in our own apps.

I could provide a PR, but I would like to discuss how I should do it beforehand. Would you rather do it like on Android and remove the schemes alltogether and try to open all links? Or should we (if thats even possible) add a configuration parameter (schemesToHandle) somewhere which is read by the in app browser?

malua avatar Mar 24 '25 16:03 malua

Please try 7.6.8 of @6.14.0 I fixed deep link iOS + prevent deep links in both platform and made this website to test and explain how to config deep links: https://aasa-tester.capgo.app/

riderx avatar Mar 26 '25 00:03 riderx

Thanks, seems to work!

Randati avatar May 21 '25 11:05 Randati

Thank you, also works for us :)

malua avatar May 22 '25 07:05 malua