Error: toLowerCase of undefined


Mario Steinbacher

Hello David!

Do you have any experiences with ther error Cannot read property 'toLowerCase' of undefined when executing the generated shell file on an mac device?

I have updated to the latest mac os(11.3) node(16.0.0) and cordova (10.0.0) XCode(12.4)

During executing the cordova_ios_release.sh it tells me after each plugin or even cordova-ios(6.2.0) : Cannot read property 'toLowerCase' of undefined and then it ends aflter all plugins with the error Cannot read property 'toLowerCase' of undefined and Paused...

Have you ever had that problem? I found some forum entries but these are about two years old and they say it is solved with cordova-ios 5.x but now I have 6.2.0 and do have this problem

best regards

Mario


Mario Steinbacher

I think I found it.

the problem are the new ios preference tags in the generated config.xml.

they are missing the name atrribute and also the value attribute.

best regards

Mario

P.S. And what also could be usefull is this plugin https://github.com/TheMattRay/cordova-plugin-wkwebviewxhrfix


Mario Steinbacher

or now this one

https://github.com/oracle/cordova-plugin-wkwebview-file-xhr


decsoft

Hello Mario,

We can touch here a couple of things. First of all, the error that you describe, in principle, is not related with any specific platform. The "toLowerCase" is method of string variables in Javascript. Any string variable have several methods, and, "toLowerCase" is one of them. If we call to that method using another variable type, like a number, then we get the error that you describe, no matter the platform in wich the app is running. In particular, apparently your error refers to an "undefined" variable: certainly, undefined variable do not have the "toLowerCase" method, so we get the error.

On the other hand, if we are talking about the usage of the "WKWebView", certainly there are two different webviews in the iOS platforms: the "old" webview and the new "WKWebView". In order to use the modern / new webview (which is recommended) what we must do is to include the below XML stuff into the app / options / Cordova / Configuration / Extra XML, as is explained in this forum's thread:

In fact, the current release of DecSoft App Builder, have a recently added option in app / options / Cordova / iOS, checked by default, that incorporate the above stuff in the Cordova's configuration file automatically, so we no need to add that stuff in the previously mentioned app option. Doing that, and using the latest Apache Cordova version in Mac OS (which is also recommended) we are ready to use the new / latest webview for iOS, and, in fact there is no problem to call to local files using XHR, so, in few words, we no need any Cordova plugin to do that.

Please, Mario, don't hesitate to post here if you have any further questions.



Mario Steinbacher

Hello David!

thank you for your detailed answer.

but the the config.xml gernerated by app builder adds these tags

and not the correct ones

thats the reason for the error because the configparser istn't able to find the name attribute.

the file-xhr error: I have to try it again but in the past when I was using the new WKWebView I only got a blank white page and a XMLHttp security error in the console because of loading from file://

and this was the reason I meantioned the xhr plugin because with this it worked.

When I have more info if it works I'm gonna reply here. (have to update xcode but ran out of disk space .... :-( )

best regards

Mario


decsoft

Hello Mario,

You are absolutely right! It's my fault. The implementation of the referred tags in the previous AB release are completely wrong. I just updated AB again in order to implement that tags as expected. About your problem with the AJAX calls... I think it's a question related with previous Cordova iOS versions... that is... with the latest (the current one) you can call to local app's files without problems, the app run as expected (with the current iOS WebView) and we no need to use any additional Cordova plugin to that. Thanks again, Mario, for the error report!


Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.