Hello, I'm using Connect IQ 7.2.1 and I'm facing some issues with the makeWebRequest function when using Venu3S as device.
I'm using the official documentation (https://developer.garmin.com/connect-iq/api-docs/Toybox/Communications.html) with this code:
using Toybox.System;
using Toybox.Communications;
function onReceive(responseCode, data) {
if (responseCode == 200) {
System.println("Request Successful");
}
else {
System.println("Response: " + responseCode);
};
};
function makeRequest() {
var url = "https://www.garmin.com";
var params = {
"definedParams" => "123456789abcdefg"
};
var options = {
:method => Communications.HTTP_REQUEST_METHOD_GET,
:headers => {"Content-Type" => Communications.REQUEST_CONTENT_TYPE_URL_ENCODED},
:responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_URL_ENCODED
};
var responseCallback = method(:onReceive);
Communications.makeWebRequest(url, params, options, responseCallback);
}
However, I do receive this error which I do not know how to solve:
venu3s: Invalid '$.Toybox.Lang.Method(responseCode as Any, data as Any) as Any' passed as parameter 4 of type 'PolyType<($.Toybox.Lang.Method(responseCode as $.Toybox.Lang.Number, data as Null or $.Toybox.Lang.Dictionary or $.Toybox.Lang.String or $.Toybox.PersistedContent.Iterator) as Void) or ($.Toybox.Lang.Method(responseCode as $.Toybox.Lang.Number, data as Null or $.Toybox.Lang.Dictionary or $.Toybox.Lang.String or $.Toybox.PersistedContent.Iterator, context as $.Toybox.Lang.Object) as Void)>'.
I'd really appreciate some support on this topic.