slack-digest/2020-12-02.md
Wed, 02 Dec 2020 08:31:26 GMT
Join the conversation at slack.cordova.io
Tue, 01 Dec 2020 12:16:47 GMT
@raitomakesgames says
hey @jcesarmobile, yes I know. The issue we are having is when we are recording a video.
Tue, 01 Dec 2020 19:22:06 GMT
@mpriddy says
Howdy, sports fans.
Tue, 01 Dec 2020 19:23:14 GMT
@mpriddy says
I’m running into a problem with migrating to WKWebView - and can’t figure out how to inspect my app in the iOS simulator.
Tue, 01 Dec 2020 19:24:19 GMT
@mpriddy says
The iOS simulator doesn’t have an option to enable it in the Safari settings - and what I’ve read suggests that remote inspection is “always on” in the iOS simulator.
Tue, 01 Dec 2020 19:24:44 GMT
@mpriddy says
Despite this, the simulator doesn’t show up in the Safari Develop menu.
Tue, 01 Dec 2020 19:26:11 GMT
@norman137 says
Depending on what version of iOS you're running you may need to use the Safari Tech Preview on the mac
Tue, 01 Dec 2020 19:26:35 GMT
@mpriddy says
Hmm. I have that laying around.
Tue, 01 Dec 2020 19:27:54 GMT
@mpriddy says
Nice! That worked.
Tue, 01 Dec 2020 19:28:32 GMT
@mpriddy says
I hadn’t seen that tidbit anywhere, Norman. Thank you!
Tue, 01 Dec 2020 19:28:39 GMT
@mpriddy says
Now let’s get this thing to break again.
Tue, 01 Dec 2020 19:28:40 GMT
@mpriddy says
😄
Tue, 01 Dec 2020 19:29:26 GMT
@norman137 says
Apple likes to release ios versions and their mac safari counterpart lags behind so the current prod version of safari doesn't know how to communicate with the newer ios safari.
Tue, 01 Dec 2020 19:30:15 GMT
@mpriddy says
I see. Does … the … number in the simulator represent the version of iOS its running?
Tue, 01 Dec 2020 19:30:26 GMT
@mpriddy says
Tue, 01 Dec 2020 19:31:36 GMT
@mpriddy says
That appears to be the case.
Tue, 01 Dec 2020 19:31:40 GMT
@norman137 says
I believe so
Tue, 01 Dec 2020 19:31:56 GMT
@mpriddy says
I took a look in the Settings > General > About
Tue, 01 Dec 2020 19:32:00 GMT
@mpriddy says
And those values match.
Tue, 01 Dec 2020 19:32:20 GMT
@norman137 says
iOS 12 is a bit old now, maybe in your case you just aren't running teh latest version of Mac OS
Tue, 01 Dec 2020 19:32:21 GMT
@norman137 says
?
Tue, 01 Dec 2020 19:32:36 GMT
@mpriddy says
I’m on Catalina - so, not quite to Big Sur yet.
Tue, 01 Dec 2020 19:33:16 GMT
@norman137 says
I'm not that familiar with the apple ecosystem but I think safari is locked to the os or is it independently updatable?
Tue, 01 Dec 2020 19:33:28 GMT
@mpriddy says
It sometimes gets updates.
Tue, 01 Dec 2020 19:33:33 GMT
@mpriddy says
Independent updates, I mean.
Tue, 01 Dec 2020 19:33:51 GMT
@mpriddy says
But those are more like bug fixes or security patches, I think.
Tue, 01 Dec 2020 19:34:00 GMT
@dpogue says
Safari gets updates, iOS simulator versions are tied to the Xcode version
Tue, 01 Dec 2020 19:34:01 GMT
@norman137 says
weird, woudln't expect that you needed to use the tech preview for iOS 12 devices/simulators
Tue, 01 Dec 2020 19:34:11 GMT
@dpogue says
You can run Xcode 12 (with iOS 14) on Catalina
Tue, 01 Dec 2020 19:34:21 GMT
@mpriddy says
Agree, Norman. Just happy as hell that it worked.
Tue, 01 Dec 2020 19:34:29 GMT
@dpogue says
but to debug iOS 14, you'll need the latest Safari too
Tue, 01 Dec 2020 19:34:49 GMT
@mpriddy says
Yeah, the iPhone 11 and 12 simulators run ios 14.2
Tue, 01 Dec 2020 19:35:04 GMT
@mpriddy says
(on my Mac, to clarify)
Tue, 01 Dec 2020 19:41:46 GMT
@mpriddy says
I was thinking that WKWebView was failing to load my app because of CORS violations. But I’m not seeing anything in the console.
Tue, 01 Dec 2020 19:46:04 GMT
@norman137 says
if the error is happening on startup, you'd need to refresh the webview to see it in the console. You can refresh the webview by pressing cmd+r while the inspector is focused.
Tue, 01 Dec 2020 20:14:04 GMT
@mpriddy says
I’ll give that a try, too.
Tue, 01 Dec 2020 20:18:15 GMT
@norman137 says
Basically inspector won't report on errors that occurred before the inspector was attached.
Tue, 01 Dec 2020 20:27:04 GMT
@mpriddy says
Turns out that it IS a CORS error. So I’ve updated the project to cordova-ios 6.1.1 - and still get the CORS errors.
Tue, 01 Dec 2020 20:28:15 GMT
@norman137 says
Are you accessing a remote resource or a local resource?
Tue, 01 Dec 2020 20:28:22 GMT
@mpriddy says
Local
Tue, 01 Dec 2020 20:28:33 GMT
@norman137 says
Are you using schemes?
Tue, 01 Dec 2020 20:28:41 GMT
@mpriddy says
Not sure what that means, so probably not.
Tue, 01 Dec 2020 20:29:40 GMT
@norman137 says
By default cordova-ios still uses the
file://protocol, mainly because by moving away from that protocol to a scheme, your origin changes, which means you lose access to your web storage containers, such as local storage, indexeddb, cookies, etc.
Tue, 01 Dec 2020 20:30:03 GMT
@norman137 says
So you have 2 options...
Tue, 01 Dec 2020 20:30:14 GMT
@mpriddy says
Mmm kay, the errors all do holler about
file://
Tue, 01 Dec 2020 20:30:35 GMT
@norman137 says
If maintaining those local storage containers is important and you don't wanna deal with migrating data
Tue, 01 Dec 2020 20:31:47 GMT
@norman137 says
Then you have to use a plugin... https://github.com/oracle/cordova-plugin-wkwebview-file-xhr
If you can afford to deal with data migration or the data stored in web storage containers is easily reconstructable... the better approach would be to use schemes... link incoming
Tue, 01 Dec 2020 20:32:25 GMT
@norman137 says
https://cordova.apache.org/howto/2020/07/18/uiwebview-warning.html
Tue, 01 Dec 2020 20:32:50 GMT
@norman137 says
<preference<preference name="hostname" value="localhost" />``` should be added inside `config.xml`
Tue, 01 Dec 2020 20:33:05 GMT
@mpriddy says
So, use schemes if I can - recreating local storage should be OK.
Tue, 01 Dec 2020 20:34:25 GMT
@mpriddy says
I’m having difficulty identifying where the dividing line is between these two solutions.
Tue, 01 Dec 2020 20:36:02 GMT
@norman137 says
if you don't care about maintaining data in local storage/cookies/indexedb, etc... ie the data can be easily replaced, then use schemes. Schemes solves many issues surrounding cors and other web restrictions that occur when using the
file://protocol.
Tue, 01 Dec 2020 20:36:35 GMT
@mpriddy says
I am pretty sure that rebuilding localstorage is going to be OK.
Tue, 01 Dec 2020 20:37:10 GMT
@mpriddy says
So I’m leaning toward the schemes solution. Does that involve only adding those two preferences to the config.xml - or is there more to it?
Tue, 01 Dec 2020 20:37:20 GMT
@norman137 says
Nope that should be it.
Tue, 01 Dec 2020 20:37:41 GMT
@norman137 says
Your app will appear to be hosted from
<app://localhost>instead offile://
Tue, 01 Dec 2020 20:38:10 GMT
@mpriddy says
Do those options need to be wrapped in
<platform name="ios">or can they just be “bare” in the config?
Tue, 01 Dec 2020 20:38:15 GMT
@norman137 says
You can change the scheme to your preference, but you cannot use well known schemes such as
httporhttps... and once you pick one you'd want to stick with it
Tue, 01 Dec 2020 20:38:32 GMT
@norman137 says
I believe bare
Tue, 01 Dec 2020 20:38:43 GMT
@mpriddy says
Cools. I’ma see what breaks next. 😄
Tue, 01 Dec 2020 20:39:59 GMT
@norman137 says
I haven't actually used this yet myself 😅 my apps still on [email protected] with wkwebview plugin -- so I'm not using schemes
Tue, 01 Dec 2020 20:40:59 GMT
@mpriddy says
Woot! It builds and runs in the simulator.
Tue, 01 Dec 2020 23:00:38 GMT
@mpriddy says
Predictably, I’m getting CORS errors from switching to WKWebView
Tue, 01 Dec 2020 23:01:25 GMT
@mpriddy says
For downloaded local files, I solve this problem by replacing
file://with<app://localhost>
Tue, 01 Dec 2020 23:02:11 GMT
@mpriddy says
But I’m getting CORS errors for remote resources, too: > Origin
<app://localhost>is not allowed by Access-Control-Allow-Origin.
Tue, 01 Dec 2020 23:02:48 GMT
@mpriddy says
So, would that require headers to be added to the remote web server?
Tue, 01 Dec 2020 23:19:28 GMT
@norman137 says
yah
Tue, 01 Dec 2020 23:19:35 GMT
@norman137 says
so schemes solves CORS issues when fetching local sources
Tue, 01 Dec 2020 23:19:52 GMT
@norman137 says
But if you're communicating with external servers, the server needs to respond with the appropriate CORS headers
Tue, 01 Dec 2020 23:20:59 GMT
@norman137 says
If you're new to CORS, I would recommend reading through https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
I also have a blog post that is more specific to cordova on CORS at https://breautek.com/2020/07/14/enabling-cors/
Tue, 01 Dec 2020 23:21:05 GMT
@mpriddy says
So, my DevOps team would need to modify our web server to send
Access-Control-Allow-Origin: <app://localhost>or something?
Tue, 01 Dec 2020 23:22:36 GMT
@norman137 says
Yes
Tue, 01 Dec 2020 23:22:57 GMT
@mpriddy says
Your feedback is invaluable. Thank you.
Tue, 01 Dec 2020 23:23:47 GMT
@norman137 says
It doesn't have to be static either, my server does this dynamically by looking at the request
Originheader and if it's acceptable, then I set theAccess-Control-Allow-Originon the response to the value of the requestOriginheader.
Tue, 01 Dec 2020 23:24:44 GMT
@norman137 says
the origin will be for the cordova app will be
<scheme>://<hostname>as set via the preferences earlier inconfig.xml
Tue, 01 Dec 2020 23:25:18 GMT
@mpriddy says
Just as I suspected. I’m sending off the request to our DevOps team.
Tue, 01 Dec 2020 19:04:05 GMT
@joel says
Hello! I have a plugin using the
podspecelement anduse-frameworksattribute, however the generated Podfile does not have theuse_frameworks!directive after prepare and build has been run. I think it should be there, but not 100% sure on the mechanics. What file can I look at to debug the creation of the Podfile? cordova-ios 6.1.1, cordova 9.0.0.
Tue, 01 Dec 2020 19:57:00 GMT
@joel says
Or just as a starter, is anyone using the
use-frameworksattribute?
Tue, 01 Dec 2020 19:58:15 GMT
@dpogue says
yeah, I have a plugin that does and it seems to work...
<podspec><config></config> <pods use-frameworks="true"> <pod name="Example" /> </pods> </podspec>```
Tue, 01 Dec 2020 20:01:37 GMT
@joel says
It's on the
podssub element 🤦♂️ .
Tue, 01 Dec 2020 12:32:16 GMT
@kkubicki2 says
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
Tue, 01 Dec 2020 13:12:26 GMT
@norman137 says
what node version are you using?
Tue, 01 Dec 2020 13:17:27 GMT
@kkubicki2 says
❯v15.3.0```
Tue, 01 Dec 2020 13:17:37 GMT
@kkubicki2 says
❯10.0.0```
Tue, 01 Dec 2020 13:17:44 GMT
@kkubicki2 says
❯7.0.14```
Tue, 01 Dec 2020 13:18:09 GMT
@kkubicki2 says
I had this project up and running
Tue, 01 Dec 2020 13:18:19 GMT
@kkubicki2 says
and then copied it to another directory and this happens
Tue, 01 Dec 2020 13:18:22 GMT
@kkubicki2 says
during plugin add
Tue, 01 Dec 2020 13:20:09 GMT
@kkubicki2 says
also
Failed to fetch plugin file:../../../plugins/myPlugin via registry.
Tue, 01 Dec 2020 13:20:17 GMT
@kkubicki2 says
what does it mean `via registry"
Tue, 01 Dec 2020 13:21:07 GMT
@prasunjajodia says
The plugin location seems to be local.. So when you moved it to another directory, it couldn't find your plugin anymore
Tue, 01 Dec 2020 13:21:21 GMT
@norman137 says
Cordova does not work yet with NPM 7
Tue, 01 Dec 2020 13:21:21 GMT
@prasunjajodia says
At least that's what I think happened
Tue, 01 Dec 2020 13:23:44 GMT
@kkubicki2 says
CordovaError:up to date in 338ms 7 packages are looking for funding run `npm fund` for details at getTargetPackageSpecFromNpmInstallOutput (/usr/local/lib/node_modules/cordova/node_modules/cordova-fetch/index.js:91:15) at processTicksAndRejections (node:internal/process/task_queues:93:5) { jse_shortmsg: 'Could not determine package name from output:\n' + 'up to date in 338ms\n' + '\n' + '7 packages are looking for funding\n' + ' run `npm fund` for details', jse_info: {} }```
Tue, 01 Dec 2020 13:23:57 GMT
@kkubicki2 says
trying to downgrade npm
Tue, 01 Dec 2020 13:24:37 GMT
@kkubicki2 says
any recommendation what version to install ?
Tue, 01 Dec 2020 13:24:40 GMT
@norman137 says
In general, bleeding edge versions, AKA odd-versions of node isn't tested or supported as these are short-lived versions. Most of the time they'll work, but mileage may vary.
More specifically NPM 7 have some changes that breaks the cordova tooling, which produces that result you just pasted.
npm install npm@6 -gwill downgrade NPM back down to 6, but your milage may still vary on Node 15.
Tue, 01 Dec 2020 13:25:36 GMT
@norman137 says
It's a bit odd though...
> TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined Generally I only see this with users running < Node 10.10 -- because Cordova uses a feature that was only introduced starting Node 10.10.
Tue, 01 Dec 2020 13:26:20 GMT
@norman137 says
But perhaps in this case, it's being caused by a side effect of the npm problem
Tue, 01 Dec 2020 13:26:37 GMT
@kkubicki2 says
I'm also on Big Sur so maybe that's the issue too 😞
Tue, 01 Dec 2020 13:26:57 GMT
@prasunjajodia says
sidenote, if you want to work with bleeding edge but have to downgrade at times for projects, I recommend you use something like NVM (node version manager) Helps you switch between node and npm versions very quickly
Tue, 01 Dec 2020 13:27:57 GMT
@norman137 says
https://github.com/apache/cordova-lib/issues/859 this is our tracking ticket for the NPM 7 issue, if you want to subscribe to see updates onit.
Tue, 01 Dec 2020 13:29:37 GMT
@kkubicki2 says
dowograding npm worked like a CHARM. If theres' any way I can thank you let me know 🙂 have a nice day, I sure will 🙂
Tue, 01 Dec 2020 13:30:21 GMT
@norman137 says
Well it's good to know that
ERR_INVALID_ARG_TYPEcan be also caused by using NPM 7.
Tue, 01 Dec 2020 13:31:00 GMT
@kkubicki2 says
it all started when I wanted to include
aarinstead ofjarin my plugin
Tue, 01 Dec 2020 13:31:13 GMT
@kkubicki2 says
I probably updated npm somewhere along the way...
Tue, 01 Dec 2020 13:31:16 GMT
@kkubicki2 says
weird
Tue, 01 Dec 2020 13:31:21 GMT
@kkubicki2 says
the old project still runs
Tue, 01 Dec 2020 13:32:04 GMT
@norman137 says
I think NPM 7 is included by default with Node 15.
Tue, 01 Dec 2020 13:32:20 GMT
@norman137 says
So by installing Node 15, you get NPM 7 installed as well.
Tue, 01 Dec 2020 13:32:35 GMT
@kkubicki2 says
I use homebrew on mac
Tue, 01 Dec 2020 13:33:10 GMT
@kkubicki2 says
installed all the latest and then downgraded, as per your recomendation. Well... phew... that was a long one, perhaps my
aarwill now work 🙂
Tue, 01 Dec 2020 13:33:13 GMT
@kkubicki2 says
Thanks again.
Tue, 01 Dec 2020 17:57:52 GMT
@chadwick.blackford says
Hallo guys! why “market://” url schema doesn’t work on cordova-android@9? We have default config
<allow-intent href="market:*"/>But IAB show error:net:ERR_UNKNOWN_URL_SCHEMEshould I add
<allow-navigation href="market://*" />too?
Tue, 01 Dec 2020 18:57:54 GMT
@jcesarmobile says
Allow-intent is for cordova webview only, not IAB
Tue, 01 Dec 2020 18:59:03 GMT
@jcesarmobile says
Well, depends on the target you used on IAB, but IAB is really used when you launch with _blank
Tue, 01 Dec 2020 19:13:56 GMT
@chadwick.blackford says
I fixed this with
_system
Tue, 01 Dec 2020 19:14:34 GMT
@chadwick.blackford says
adding this
<allow-navigation href="market://*" />doesn’t help with IAB