Running a mobile app bootstrap on the front end, and a docker backend with security. The app works fine on the web side, and the ios side. On the android it does not access the backend databases. With or without a security restrict which is my goal.
I have a simple query on the backend (DOCKER on localhost), and server connect on the front end.
Had the same problem. Android emulator doesn’t allow * for cors origin.
Try this:
If your preview (on android emulator) is localhost:1111 you need to declare THE PORT on the backend project, but as soon as you change to the mobile project, the port changes again (there’s a feature request of that)
The workaround is using an external ftp editor (or a web based file editor) and write the port of the android emulator preview (wich you can get from the dev tool that teodor says) on the config file.
Will attach some screenshot later because I know my english sucks and maybe I’m not being 100% clear.
Is that the android emulator?
In dev tools (on the android emulator) what is the port of the page you’re on?
The problem is:
The preview (always talking on android emulator) is on port :1234
Go to the backend project and add :1234 to cors
Go to the mobile project and the preview is now on port :5678
Go to the backend project and add :5678 to cors
And it’s a loop.
The workaround that Keith provided up there seems a nice way to handle it.
I prefeer editing config.php (backend) with an external editor.
As soon as you change the wappler project (mobile<–>backend) the port changes again.
PS: This only happens with the android emulator, if you create a debug apk you’ll be able to get that without no problems.
Thanks George and Franse. I managed to get around the issue by uploading to a live server with https. I got the data back, but am getting connection refused on various. see image.
So great for all of your support. thank you. Of course now there is another issue on the iOS side. not returning data when I put security on. Works on android and web, but not iOS. Lets me login, no unauthorized or anything. Just doesn’t show the data. Will show a server connect data fine with no security. I tried adding a session id on the backend, but not sure if I did that correctly within Wappler.
I get this in the Xcode console
-[RTIInputSystemClient remoteTextInputSessionWithID:performInputOperation:] perform input operation requires a valid sessionID
Check the capacitor docs.
While I was reading for an Android project I saw some things that must be manually added.
Also make sure you have the last xcode, some people recommended it on the apple forum.
OK went through all that. I did hookup an actual device instead of the simulator. Cleaned up a bunch of errors. I removed security and still the same issue. I do not get a login error, and the success page returns. Works fine on web and android. My login identity and the fields from the query are not displaying on the page (IOS only). The alert I setup for login failure works. the login appears to be working.
Also works on IOS, android, and web view in the Wappler editor. just not on the iOS device or simulator.
Get this error but seems unrelated.
If any idea it would be greatly appreciated.
2023-11-30 18:47:11.543358-0500 App[518:8988] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///private/var/mobile/Containers/Data/Application/38FE4282-DD06-41D2-A09C-5AA1B4908967/Library/Cookies/Cookies.binarycookies
⚡️ Loading app at capacitor://localhost...
2023-11-30 18:47:11.959096-0500 App[518:9194] Metal API Validation Enabled
⚡️ WebView loaded
2023-11-30 18:47:16.486258-0500 App[518:8988] API error: <_UIKBCompatInputView: 0x105618f30; frame = (0 0; 0 0); layer = <CALayer: 0x281df5020>> returned 0 width, assuming UIViewNoIntrinsicMetric
2023-11-30 18:47:16.486432-0500 App[518:8988] API error: <_UIKBCompatInputView: 0x105618f30; frame = (0 0; 0 0); layer = <CALayer: 0x281df5020>> returned 0 width, assuming UIViewNoIntrinsicMetric
⚡️ WebView loaded