Acknowledged

Visual Studio Code and makeWebRequest and SDK 4.1.6+

Hi,
this does not work with SDK 4.1.6 and later in Visual Studio Code:
Communications.makeWebRequest("https://api.openweathermap.org/data/2.5/weather", params, options, method(:onReceiveWeather));
Error:
Invalid '$.Toybox.Lang.Method(responseCode as Any, data as Any) as Any'
passed as parameter 4 of type
'PolyType<(callback(responseCode as $.Toybox.Lang.Number, data as Null or $.Toybox.Lang.Dictionary or $.Toybox.Lang.String) as Void)
or
(callback(responseCode as $.Toybox.Lang.Number, data as Null or $.Toybox.Lang.Dictionary or $.Toybox.Lang.String, context as $.Toybox.Lang.Object) as Void)>'.
Unfortunately I have no idea what could be causing this.
Has the function been removed or changed?
Regards
Joerg
Parents
  • Had the same issue for my code. What solved the problem was introducing types to the http handling callback function to this:

    ```

    function onReceive(
    responseCode as Toybox.Lang.Number,
    data as Toybox.Lang.Dictionary
    ) as Void {
    ```
Comment
  • Had the same issue for my code. What solved the problem was introducing types to the http handling callback function to this:

    ```

    function onReceive(
    responseCode as Toybox.Lang.Number,
    data as Toybox.Lang.Dictionary
    ) as Void {
    ```
Children
No Data