Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS Simulator shows 'about:blank' when scheme/hostname preferences are set #1215

Open
3 tasks done
cellcrowd opened this issue Jan 17, 2022 · 3 comments
Open
3 tasks done

Comments

@cellcrowd
Copy link

cellcrowd commented Jan 17, 2022

Bug Report

Problem

When adding

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

into the <platform name="ios"> section of config.xml, the iOS simulator shows "about:blank" page instead of "index.html" page

What is expected to happen?

App should display "index.html" page

What does actually happen?

App displays "about:blank" page

Information

This bug does not happen on real devices, only in the simulator

When running document.location = 'app://index.html' through the Safari debugger, the page loads. However, it fails to load CSS with error: Did not parse stylesheet at 'app://index.html/css/index.css' because non CSS MIME types are not allowed in strict mode.

Running document.location = 'app://localhost' does the same as above with error: Did not parse stylesheet at 'app://localhost/css/index.css' because non CSS MIME types are not allowed in strict mode.

Running document.location = 'app://' shows 'about:blank'

Running document.location = 'app://localhost/index.html' does not do anything (returns "app://localhost/index.html" = $1 in console)

Command or Code

  • cordova create hello com.example.hello HelloWorld
  • cordova platform add ios
  • cordova emulate ios --target="iPhone-8-Plus, 15.2" (shows index.html)
  • added scheme/hostname preferences inside ios section as per above
  • cordova emulate ios --target="iPhone-8-Plus, 15.2" (shows about:blank)

Environment, Platform, Device

iOS Simulator on Mac OS Big Sur 11.6, Mac Mini (M1, 2020) 8GB

Version information

Cordova CLI 11.0.0
Cordova iOS 6.2.0

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@cellcrowd
Copy link
Author

Confirmed working when starting the simulator from XCode instead of the CLI

@jcesarmobile
Copy link
Member

There is a known issue on iOS simulator when running on M1 macs.
If you say it works when you run from Xcode and not from the CLI, it's probably that Xcode is setting rosetta mode on the simulator, not sure if it would be possible to do the same from the CLI.

@mcake8
Copy link

mcake8 commented Aug 19, 2022

I got the very same issue, but even from the XCode it doesn't work for me
Device: MacBook Pro (16-inch, 2021) M1 Pro 16 GB
Cordova CLI 11.0.0
Cordova iOS 6.2.0

if I set the config like this

<preference name="scheme" value="app" />
<preference name="hostname" value="www.my-awesome-site.com" />

App displays "about:blank" page, and the XCode console says something like this

2022-08-19 20:16:15.564214+0400 HelloWorld[42258:3653880] [db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-10817 "(null)" UserInfo={_LSFunction=_LSSchemaConfigureForStore, ExpectedSimulatorHash={length = 32, bytes = 0xde692fe4 74cb27a9 46141ef2 d51b2967 ... 1bf15bf0 1946d147 }, _LSLine=405, WrongSimulatorHash={length = 32, bytes = 0xb5aceade 20f27303 c39ab815 65e94ec7 ... cd950a70 602e0a75 }}
2022-08-19 20:16:15.848182+0400 HelloWorld[42258:3653880] [Process] 0x7fdb00025c20 - [pageProxyID=11, webPageID=12, PID=42283] WebPageProxy::didFailProvisionalLoadForFrame: frameID=3, domain=WebKitErrorDomain, code=102
2022-08-19 20:16:15.849028+0400 HelloWorld[42258:3653880] Failed to load webpage with error: Frame load interrupted

It works well if I set it like so

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

I'm completely confused, I wasn't able to find clear documentation for those preferences.
Tried to run the simulator with the Cordova CLI and the XCode both gave me the same result.
Also before moving to the M1 chip everything was working well on the Intel chip with the first example name="scheme" value="app".

So the question is, should I use different config settings for the production and debug, or should I put it the way it works on the simulator? Or maybe I should not use the simulator for the ios on the M1 chip and just leave the config like it was working before on the Intel?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants