Cannot load pages using custom scheme, CDVURLSchemeHandler not called

Viewed 90

I have native app with an embedded Cordova Web view, and the app loads fine over the default file scheme. But when setting the scheme and hostname config preferences, the web view points to about:blank.

<preference name="scheme" value="app" />
<preference name="hostname" value="localhost" />

What we know...

  1. Cordova (6.2.0) detects that the scheme is not file, and loads the CDVURLSchemeHandler plugin. Its initializer is called.

  2. CDVWebViewEngine.loadRequest tries to load app://localhost/index.html, and web view's scheme handler is set ([((WKWebView*)_engineWebView).configuration urlSchemeHandlerForURLScheme:@"app"] return non-null). Yet startURLSchemeTask method is never called. Why not???

  3. Just to be sure, I added the custom scheme to Info.plist:

     <key>CFBundleURLTypes</key>
     <array>
         <dict>
             <key>CFBundleURLSchemes</key>
             <array>
                 <string>app</string>
             </array>
             <key>CFBundleURLName</key>
             <string>com.myapp</string>
         </dict>
     </array>
    

What did I miss?

0 Answers
Related