Undefined variable. Irritants: (yail/try-catch) - Help needed

I've got the error - undefined variable. Irritants: (yail/try-catch) - with the command bellow's execution (botton click).

I'm running the simple application on ios by Ai Companion connection.


I've got all the variables initialized at the begining blocks.

Any help?

Show us the global inits for all those variables?

Also, show us the events triggered downstream from this event, including:

  • Clock1.Timer
  • Web1.ReceivedText (?)

It follows the definition section and the Clock1 event block.

The command implemented by the block ATUALIZAR_DATA ... is used to update a value in ThingSpeak without any response handling.

The error occurs exactly due to the indicated get command.

Tks in advance.

Upstream globals look okay, as does the timer.

That leaves the Web1 event that catches the result of the Get.

You did not show that.

(You can remove your key from the images, to protect it.)

I have not define any further job besides the shown blocks. I do nothing with any answer from the get command. This is a command just to write not to get anything from the web.

Problably I'm doing wrong with no addictional handling but I do not need any other doing.

The command works well (write the content into ThingSpeak) but get the error message after execution.

Here's a sample event block, change the Label.


It's the only help I can think of to diagnose this further.

(Post deleted)

In iOS, the use of variables must be done carefully.
Variables are meant for values that change. If you store fixed texts, component names, or constant numbers in variables, this may work on Android, but it can cause problems on iOS.

Even on Android, using variables for values that never change leads to unnecessary memory usage.

If a value will not change, it is better to keep it inside a procedure.
If a value (for example, a URL) is used only once, you should enter it directly as text, instead of storing it in a variable.

A good approach is to:

  • Put all fixed values inside a procedure
  • Call this procedure in the Screen.Initialize block

If the link addresses used in the variables are correct, the application will work properly.

Post a screenshot of it (and the aia).
Device and iOS version?

Hi, ABG,

I just did as you suggested. Even thogugh not neccessary, I use the When GotText block as suppose to handle the error event. It worked well as the error did not occur anymore.

The only reason I can think about the solution (using a GotText for doing nothing meaingfull) is that I already use for a reading block the same Web1 instance. So I decided use another web interface (Web2) for the writing block withou using the GotTex block. It worked as well.

I have no knowledge how MIT app works behind the cenes, but I consider that the best way to work in this situation (I need a parameterized block to handle with differents configurations of wtiting and reading actions depending on the context: ThingSpeak channels and fields) is using different web interfaces.

If I missed something in this context, I appeciate your considerations.

Tks a lot for you supporting time. I really appreciate.

Hi, Profi,

I have just started using the MIT app. I have not used the procedures blocks yet.

I tried to use the whole sentence as one single text. It didn't work well.

Besides that, I need a parameterized block to handle with differents configurations of wtiting and reading actions depending on the context: ThingSpeak channels and fields. So it seems the best practice using a parameterized block.

Reffer to my answer message to ABF regarding the using of different web interfaces. It worked by itself without any addictional error handing procedure.

Tks. Apreciate your time.

Hi, Anke.

The problem has already been solved.

Tks a lot for your support.

Please let us know what rhe solution was
Taifun

I am guessing the get text block relieved the web infrastructure of a case of constipation.

Replies arrived, but the mailbox was full.

I just use anotrher web interface (Web2) to avoid any eventual conflit between the read and write command blocks. I use Web1 for readings and Web2 for writings.

The solution suggest by ABD it does work well. He suggested to include a When GotText block to receive any not handled response from the Set .Url to block.

I think there must be something going on here though. The try-catch macro is defined in App Inventor itself and is a core part of its runtime. There should never be a situation in which it cannot be found. Does your app involve screen switching at all?

Hi ewpatton,

Do you prefer to analyze my application to investigate deep the problem? But to run you'll need to have your own back support of ThingSpeak user. I will send the applications without my TS channels and keys definitions.

Just tell me if it's ok for you to analyze the code and how I can send you the file.

Rgds,

Eilson

You can use the checkpoint feature to make a copy of your app. In the checkpoint version, remove any private information as needed. Then you can export that file and send it to me via a private message on this forum.

Ok. Sent.