iOS conversion from Android Issues

An error occurred


I don't know the meaning of this error

Is the conversion of the original Android system to IOS incompatible?

Assuming that this is an App Inventor error, that error number indicates that the encoding used in the Web component isn't supported on iOS. Typically, we'd recommend only using UTF-8 for working with web content (this is the W3C's recommendation). If you'd like, you can either post your AIA here or PM it to me so we can investigate further.

I also encountered this screen error 1102 when using the companion for iOS. What I am trying to do is a Web.Get API request that has worked with my Android app for years. After doing some tests, I would like to share with you what I have found out.

TL;DR: The Web component for iOS doesn't accept responses with encoding strings wrapped in quotation marks like "UTF-8" instead of UTF-8.

First, when using the Web component, I got error messages like cdr: pair required, basically the same messages as shown in this thread. Those can be traced back to missing RequestHeaders, as Ferran Simon pointed out here:

The Web Block component in iOS needs always the block RequestHeaders but in Android this RequestHeaders is not necesary.

After solving this problem by adding the headers, now the 1102 error arised.
While other APIs are working fine with my Web component setup, this specific API doesn't.

The error message says: The encoding "utf-8" is not supported, which seems weird because that's the preset value in de Designer. I tried to change the Web component's ResponseTextEncoding value, which didn't work either because it appears not to be implemented in iOS yet.


Instead of using a Web component, I tried entering the request URL in a WebViewer component, which worked fine and easily showed the result (not possible to extract).

So I had a look into the header that is returned from the API:

HTTP/1.1 200 OK
Date: Tue, 06 Feb 2024 07:36:15 GMT
Content-Type: text/javascript; charset="UTF-8"
Content-Length: 90
Connection: keep-alive
Cache-Control: no-cache
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET

Finally, I happened to find out that the quotation marks around UTF-8 are the root cause! The Web component for iOS doesn't expect the UTF-8 string to be wrapped in quotation marks. This source describes this kind of problem, too.

For testing reasons I made a mock API, that sends the charset either with or without quotation marks.

  • Content-Type: text/javascript; charset="UTF-8" doesn't work on iOS, but on Android
  • Content-Type: text/javascript; charset=UTF-8 works on both platforms

I would like to kindly ask the App Inventor team to let the Web component for iOS accept encodings with quotation marks as well. It already takes into account lowercase/uppercase (utf-8, UTF-8) and hypens (utf8, utf-8).

Indeed the grammar for headers in RFC822 does technically allow for quoted-string in the parameter value. I have submitted a patch that will support using quoted-string in this way.

That said, the use of quoted-string is only necessary when the string contains special tokens (defined in the tspecials token class), which the string "utf-8" does not contain, so use of the quotes is unnecessary and, in fact, increases the overall payload of the response. Every example I have seen using charset has never quoted the charset name for the aforementioned reason. Unless you have a good reason to do so I'd recommend not doing that since it's pretty much what everyone else does.