Thingsboard provisioning example not working - thingsboard

For some reason https://github.com/thingsboard/thingsboard-arduino-sdk/blob/master/examples/0008-esp8266_provision_device/0008-esp8266_provision_device.ino is not compiling on Windows Arduino IDE 1.8.19 for FireBeetle ESP32. Error as follows:
Arduino: 1.8.19 (Windows 10), Board: "FireBeetle ESP32-E, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, Core 1, Core 1, None"
C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:7: warning: "WIFI_AP" redefined
#define WIFI_AP "Lemmiku IoT"
In file included from C:\Users\Timo\AppData\Local\Arduino15\packages\DFRobot\hardware\esp32\0.2.1\libraries\WiFi\src/WiFi.h:31,
from C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:4:
C:\Users\Timo\AppData\Local\Arduino15\packages\DFRobot\hardware\esp32\0.2.1\libraries\WiFi\src/WiFiType.h:32: note: this is the location of the previous definition
#define WIFI_AP WIFI_MODE_AP
Provision_test:86:46: error: conversion from 'void(Provision_Data&)' {aka 'void(const ArduinoJson6194_F1::ObjectConstRef&)'} to non-scalar type 'const Provision_Callback' requested
const Provision_Callback provisionCallback = processProvisionResponse;
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayIterator.hpp:8,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayRef.hpp:8,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:24,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,
from C:\Users\Timo\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:16,
from C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:2:
C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantRef.hpp: In instantiation of 'typename ArduinoJson6194_F1::enable_if<((! ArduinoJson6194_F1::is_same<T, char*>::value) && (! ArduinoJson6194_F1::is_same<T, char>::value)), T>::type ArduinoJson6194_F1::VariantConstRef::as() const [with T = ArduinoJson6194_F1::ObjectRef; typename ArduinoJson6194_F1::enable_if<((! ArduinoJson6194_F1::is_same<T, char*>::value) && (! ArduinoJson6194_F1::is_same<T, char>::value)), T>::type = ArduinoJson6194_F1::ObjectRef]':
C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:75:76: required from here
C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantRef.hpp:253:34: error: invalid use of incomplete type 'class ArduinoJson6194_F1::InvalidConversion<ArduinoJson6194_F1::VariantConstRef, ArduinoJson6194_F1::ObjectRef>'
return Converter::fromJson(*this);
~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
In file included from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantRef.hpp:14,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayIterator.hpp:8,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayRef.hpp:8,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:24,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,
from C:\Users\Timo\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:16,
from C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:2:
C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/Converter.hpp:14:7: note: declaration of 'class ArduinoJson6194_F1::InvalidConversion<ArduinoJson6194_F1::VariantConstRef, ArduinoJson6194_F1::ObjectRef>'
class InvalidConversion; // Error here? See https://arduinojson.org/v6/invalid-conversion/
^~~~~~~~~~~~~~~~~
Multiple libraries were found for "WiFi.h"
Used: C:\Users\Timo\AppData\Local\Arduino15\packages\DFRobot\hardware\esp32\0.2.1\libraries\WiFi
Not used: C:\Users\Timo\Documents\Arduino\libraries\WiFiEspAT
Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
exit status 1
conversion from 'void(Provision_Data&)' {aka 'void(const ArduinoJson6194_F1::ObjectConstRef&)'} to non-scalar type 'const Provision_Callback' requested
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Can anyone help out why it's not working?
#devaskim I tried, but nothing:
C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:6: warning: "WIFI_AP" redefined
#define WIFI_AP "Lemmiku IoT"
In file included from C:\Users\Timo\AppData\Local\Arduino15\packages\DFRobot\hardware\esp32\0.2.1\libraries\WiFi\src/WiFi.h:31,
from C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:3:
C:\Users\Timo\AppData\Local\Arduino15\packages\DFRobot\hardware\esp32\0.2.1\libraries\WiFi\src/WiFiType.h:32: note: this is the location of the previous definition
#define WIFI_AP WIFI_MODE_AP
Provision_test:85:46: error: conversion from 'void (*)(Provision_Data&)' {aka 'void (*)(const ArduinoJson6194_F1::ObjectConstRef&)'} to non-scalar type 'const Provision_Callback' requested
const Provision_Callback provisionCallback = &processProvisionResponse;
^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayIterator.hpp:8,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayRef.hpp:8,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:24,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,
from C:\Users\Timo\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:16,
from C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:2:
C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantRef.hpp: In instantiation of 'typename ArduinoJson6194_F1::enable_if<((! ArduinoJson6194_F1::is_same<T, char*>::value) && (! ArduinoJson6194_F1::is_same<T, char>::value)), T>::type ArduinoJson6194_F1::VariantConstRef::as() const [with T = ArduinoJson6194_F1::ObjectRef; typename ArduinoJson6194_F1::enable_if<((! ArduinoJson6194_F1::is_same<T, char*>::value) && (! ArduinoJson6194_F1::is_same<T, char>::value)), T>::type = ArduinoJson6194_F1::ObjectRef]':
C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:74:76: required from here
C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantRef.hpp:253:34: error: invalid use of incomplete type 'class ArduinoJson6194_F1::InvalidConversion<ArduinoJson6194_F1::VariantConstRef, ArduinoJson6194_F1::ObjectRef>'
return Converter<T>::fromJson(*this);
~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
In file included from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantRef.hpp:14,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayIterator.hpp:8,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayRef.hpp:8,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:24,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,
from C:\Users\Timo\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:16,
from C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:2:
C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/Converter.hpp:14:7: note: declaration of 'class ArduinoJson6194_F1::InvalidConversion<ArduinoJson6194_F1::VariantConstRef, ArduinoJson6194_F1::ObjectRef>'
class InvalidConversion; // Error here? See https://arduinojson.org/v6/invalid-conversion/
^~~~~~~~~~~~~~~~~
Multiple libraries were found for "WiFi.h"
Used: C:\Users\Timo\AppData\Local\Arduino15\packages\DFRobot\hardware\esp32\0.2.1\libraries\WiFi
Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
Not used: C:\Users\Timo\Documents\Arduino\libraries\WiFiEspAT
exit status 1
conversion from 'void (*)(Provision_Data&)' {aka 'void (*)(const ArduinoJson6194_F1::ObjectConstRef&)'} to non-scalar type 'const Provision_Callback' requested
Hmm, I got something different this time:
C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:6: warning: "WIFI_AP" redefined
#define WIFI_AP "Lemmiku IoT"
In file included from C:\Users\Timo\AppData\Local\Arduino15\packages\DFRobot\hardware\esp32\0.2.1\libraries\WiFi\src/WiFi.h:31,
from C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:3:
C:\Users\Timo\AppData\Local\Arduino15\packages\DFRobot\hardware\esp32\0.2.1\libraries\WiFi\src/WiFiType.h:32: note: this is the location of the previous definition
#define WIFI_AP WIFI_MODE_AP
In file included from c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayIterator.hpp:8,
from c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayRef.hpp:8,
from c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:24,
from c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,
from c:\Users\Timo\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:16,
from C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:2:
c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantRef.hpp: In instantiation of 'typename ArduinoJson6194_F1::enable_if<((! ArduinoJson6194_F1::is_same<T, char*>::value) && (! ArduinoJson6194_F1::is_same<T, char>::value)), T>::type ArduinoJson6194_F1::VariantConstRef::as() const [with T = ArduinoJson6194_F1::ObjectRef; typename ArduinoJson6194_F1::enable_if<((! ArduinoJson6194_F1::is_same<T, char*>::value) && (! ArduinoJson6194_F1::is_same<T, char>::value)), T>::type = ArduinoJson6194_F1::ObjectRef]':
C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:74:76: required from here
c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantRef.hpp:253:34: error: invalid use of incomplete type 'class ArduinoJson6194_F1::InvalidConversion<ArduinoJson6194_F1::VariantConstRef, ArduinoJson6194_F1::ObjectRef>'
return Converter<T>::fromJson(*this);
~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
In file included from c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantRef.hpp:14,
from c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayIterator.hpp:8,
from c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayRef.hpp:8,
from c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:24,
from c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,
from c:\Users\Timo\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:16,
from C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:2:
c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/Converter.hpp:14:7: note: declaration of 'class ArduinoJson6194_F1::InvalidConversion<ArduinoJson6194_F1::VariantConstRef, ArduinoJson6194_F1::ObjectRef>'
class InvalidConversion; // Error here? See https://arduinojson.org/v6/invalid-conversion/
^~~~~~~~~~~~~~~~~
Multiple libraries were found for "WiFi.h"
Used: C:\Users\Timo\AppData\Local\Arduino15\packages\DFRobot\hardware\esp32\0.2.1\libraries\WiFi
Not used: C:\Users\Timo\Documents\Arduino\libraries\WiFiEspAT
exit status 1
Compilation error: exit status 1

As you've already noticed, there are two issues to fix, which I've highlighted in the code sample below.
There is also an open issue about this here: https://github.com/thingsboard/thingsboard-arduino-sdk/issues/89
Note that while this fixes the compilation issues, at least my self-hosted ThingsBoard server fails to register the provisioning request, so there's likely more that's broken with it.
// ...
// FIX #1
//
// We're dealing with const data
//
//JsonObject credentials_value = data["credentialsValue"].as<JsonObject>();
JsonObjectConst credentials_value = data["credentialsValue"].as<JsonObjectConst>();
// ...
// FIX #2
//
// Provision_Callback is a class that takes the callback as a constructor parameter
//
//const Provision_Callback provisionCallback = processProvisionResponse;
const Provision_Callback provisionCallback(processProvisionResponse);
// ...

Related

getting weird errors while trying to build ios app using flutter

this is my debug log
Automatically signing iOS for device deployment using specified development team in Xcode
project: P7NL527WV9
Running Xcode build...
Xcode build done. 75.6s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.
7.1/ios/Classes/FlutterWebView.m:575:23: warning: 'requiresUserActionForMediaPlayback' is
deprecated: first deprecated in iOS 10.0 [-Wdeprecated-declarations]
configuration.requiresUserActionForMediaPlayback = true;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mediaTypesRequiringUserActionForPlayback
In module 'WebKit' imported from
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.
7.1/ios/Classes/FlutterWebView.h:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneO
S14.0.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebViewConfiguration.h:213:28:
note: 'requiresUserActionForMediaPlayback' has been explicitly marked deprecated here
#property (nonatomic) BOOL requiresUserActionForMediaPlayback
API_DEPRECATED_WITH_REPLACEMENT("mediaTypesRequiringUserActionForPlayback", ios(9.0, 10.0));
^
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.
7.1/ios/Classes/FlutterWebView.m:587:23: warning: 'requiresUserActionForMediaPlayback' is
deprecated: first deprecated in iOS 10.0 [-Wdeprecated-declarations]
configuration.requiresUserActionForMediaPlayback = false;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mediaTypesRequiringUserActionForPlayback
In module 'WebKit' imported from
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.
7.1/ios/Classes/FlutterWebView.h:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneO
S14.0.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebViewConfiguration.h:213:28:
note: 'requiresUserActionForMediaPlayback' has been explicitly marked deprecated here
#property (nonatomic) BOOL requiresUserActionForMediaPlayback
API_DEPRECATED_WITH_REPLACEMENT("mediaTypesRequiringUserActionForPlayback", ios(9.0, 10.0));
^
2 warnings generated.
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.
7.1/ios/Classes/FlutterWebView.m:575:23: warning: 'requiresUserActionForMediaPlayback' is
deprecated: first deprecated in iOS 10.0 [-Wdeprecated-declarations]
configuration.requiresUserActionForMediaPlayback = true;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mediaTypesRequiringUserActionForPlayback
In module 'WebKit' imported from
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.
7.1/ios/Classes/FlutterWebView.h:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneO
S14.0.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebViewConfiguration.h:213:28:
note: 'requiresUserActionForMediaPlayback' has been explicitly marked deprecated here
#property (nonatomic) BOOL requiresUserActionForMediaPlayback
API_DEPRECATED_WITH_REPLACEMENT("mediaTypesRequiringUserActionForPlayback", ios(9.0, 10.0));
^
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.
7.1/ios/Classes/FlutterWebView.m:587:23: warning: 'requiresUserActionForMediaPlayback' is
deprecated: first deprecated in iOS 10.0 [-Wdeprecated-declarations]
configuration.requiresUserActionForMediaPlayback = false;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mediaTypesRequiringUserActionForPlayback
In module 'WebKit' imported from
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.
7.1/ios/Classes/FlutterWebView.h:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneO
S14.0.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebViewConfiguration.h:213:28:
note: 'requiresUserActionForMediaPlayback' has been explicitly marked deprecated here
#property (nonatomic) BOOL requiresUserActionForMediaPlayback
API_DEPRECATED_WITH_REPLACEMENT("mediaTypesRequiringUserActionForPlayback", ios(9.0, 10.0));
^
2 warnings generated.
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/SafariViewController/SafariBrowserOptions.swift:34:16: warning: unnecessary check
for 'iOS'; enclosing scope ensures guard will always be true
if #available(iOS 10.0, *) {
^
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/SafariViewController/SafariBrowserOptions.swift:12:14: note: enclosing scope here
public class SafariBrowserOptions: Options<SafariViewController> {
^
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/SafariViewController/SafariViewController.swift:66:12: warning: unnecessary check
for 'iOS'; enclosing scope ensures guard will always be true
if #available(iOS 10.0, *) {
^
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/SafariViewController/SafariViewController.swift:12:14: note: enclosing scope here
public class SafariViewController: SFSafariViewController, FlutterPlugin,
SFSafariViewControllerDelegate {
^
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/InAppBrowser/InAppBrowserWebViewController.swift:557:13: warning: setter for
'statusBarStyle' was deprecated in iOS 9.0: Use -[UIViewController preferredStatusBarStyle]
UIApplication.shared.statusBarStyle = UIStatusBarStyle(rawValue:
previousStatusBarStyle)!
^
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/InAppWebView/InAppWebView.swift:695:34: error: value of type 'WKPDFConfiguration'
has no member 'rect'
pdfConfiguration.rect = CGRect(x: rect["x"]!, y: rect["y"]!, width:
rect["width"]!, height: rect["height"]!)
~~~~~~~~~~~~~~~~ ^~~~
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/InAppWebView/InAppWebView.swift:698:9: error: cannot find 'createPDF' in scope
createPDF(configuration: pdfConfiguration) { (result) in
^~~~~~~~~
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/InAppWebView/InAppWebView.swift:713:29: error: incorrect argument label in call
(have 'completionHandler:', expected 'dataCompletionHandler:')
createWebArchiveData(completionHandler: { (result) in
^~~~~~~~~~~~~~~~~~
dataCompletionHandler
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/InAppWebView/InAppWebView.swift:1237:33: error: extra arguments at positions #2,
#3 in call
super.evaluateJavaScript(javaScript, in: frame, in: contentWorld, completionHandler:
completionHandler)
^
WebKit.WKWebView:46:15: note: 'evaluateJavaScript(_:completionHandler:)' declared here
open func evaluateJavaScript(_ javaScriptString: String, completionHandler: ((Any?,
Error?) -> Void)? = nil)
^
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/InAppWebView/InAppWebView.swift:1237:94: error: cannot convert value of type
'((Result<Any, Error>) -> Void)?' to expected argument type '((Any?, Error?) -> Void)?'
super.evaluateJavaScript(javaScript, in: frame, in: contentWorld, completionHandler:
completionHandler)
^
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/InAppWebView/InAppWebView.swift:1254:15: error: value of type 'WKWebView' has no
member 'callAsyncJavaScript'
super.callAsyncJavaScript(functionBody, arguments: arguments, in: frame, in:
contentWorld, completionHandler: completionHandler)
~~~~~ ^~~~~~~~~~~~~~~~~~~
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/SafariViewController/SafariBrowserOptions.swift:34:16: warning: unnecessary check
for 'iOS'; enclosing scope ensures guard will always be true
if #available(iOS 10.0, *) {
^
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/SafariViewController/SafariBrowserOptions.swift:12:14: note: enclosing scope here
public class SafariBrowserOptions: Options<SafariViewController> {
^
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/SafariViewController/SafariViewController.swift:66:12: warning: unnecessary check
for 'iOS'; enclosing scope ensures guard will always be true
if #available(iOS 10.0, *) {
^
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/SafariViewController/SafariViewController.swift:12:14: note: enclosing scope here
public class SafariViewController: SFSafariViewController, FlutterPlugin,
SFSafariViewControllerDelegate {
^
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/Types/URLCredential.swift:14:25: warning: comparing non-optional value of type
'[Any]' to 'nil' always returns true
if certificates != nil {
~~~~~~~~~~~~ ^ ~~~
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/Util.swift:86:25: warning: 'spotlightSuggestion' was deprecated in iOS 10.0:
renamed to 'WKDataDetectorTypes.lookupSuggestion'
return .spotlightSuggestion
^
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/Util.swift:86:25: note: use 'WKDataDetectorTypes.lookupSuggestion' instead
return .spotlightSuggestion
^~~~~~~~~~~~~~~~~~~
WKDataDetectorTypes.lookupSuggestion
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/Util.swift:121:31: warning: 'spotlightSuggestion' was deprecated in iOS 10.0:
renamed to 'WKDataDetectorTypes.lookupSuggestion'
if type.contains(.spotlightSuggestion) {
^
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/Util.swift:121:31: note: use 'WKDataDetectorTypes.lookupSuggestion' instead
if type.contains(.spotlightSuggestion) {
^~~~~~~~~~~~~~~~~~~
WKDataDetectorTypes.lookupSuggestion
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/i
os/Classes/Util.swift:216:21: warning: immutable value 'j' was never used; consider replacing
with '_' or removing it
for j in ipv6.count...8 {
^
_
Command CompileSwift failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Encountered error while building for device.
These are the plugins/packages used in the code
flutter_remix: ^0.0.3
flutter_vector_icons: ^1.0.0
Firebase
firebase_core: ^1.1.0
firebase_auth: ^3.0.0
firebase_messaging: ^11.2.6
firebase_in_app_messaging: ^0.6.0+7
cloud_firestore: ^3.1.7
firebase_storage: ^10.2.6
State Management
get: ^4.1.4
get_storage: ^2.0.2
Fonts
google_fonts: ^2.1.0
User Interface
statusbarz: ^1.0.2
lottie: ^1.0.1
flutter_hud: ^0.3.0
multiavatar: ^0.1.5
flutter_svg: ^0.22.0
carousel_slider: ^4.0.0-nullsafety.0
octo_image: ^1.0.0+1
cached_network_image: ^3.0.0
dropdown_search: ^2.0.1
shimmer: ^2.0.0
animated_background: ^2.0.0
image_picker_type: ^1.0.1
flutter_gradient_colors: ^2.0.0-prerelease-nullsafety
flutter_shimmer: ^2.0.0-prerelease-nullsafety
draggable_home: ^1.0.2
timelines: ^0.1.0
syncfusion_flutter_pdfviewer: ^19.2.47-beta
Utils
random_string_generator: ^2.0.0
path_provider: ^2.0.2
image: ^3.0.2
jiffy: ^5.0.0
url_launcher: ^6.0.7
package_info: ^2.0.2
flutter_contact: ^0.9.1+8
permission_handler: ^8.1.2
contactor_picker: ^0.0.4
flutter_native_contact_picker: ^0.0.3
nanoid: ^1.0.0
share_plus: ^3.0.4
package_info_plus: ^1.0.5
crisp: ^0.3.1
Gateway
flutter_paystack: ^1.0.5+1
flutterwave: ^1.0.1
nravepay: ^1.0.5+1
Seems to be a problem with an included dependency.
module 'WebKit' imported from
/Users/bhbj/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.
7.1/ios/Classes/FlutterWebView.h
Maybe you have imported a PDF webview package that is not compatible with iOS, or you need permissions to use it, normally you can add them in Info.plist file.

Cannot compile AudioKit 4.2.2

I've just downloaded AudioKit most recent version (4.2.2). When I ran the build_frameworks.sh I get the following error:
[AVAudioUnit?]' has no member 'compactMap'
return _effectsChain.compactMap { $0 }
^~~~~~~~~~~~~ ~~~~~~~~~~
/Users/sky/Desktop/AudioKit-4.2.2/AudioKit/Common/Nodes/Mixing/Mixer/AKMixer.swift:40:19: error: value of type '[AKNode?]' has no member 'compactMap'
self.init(inputs.compactMap { $0 })
^~~~~~ ~~~~~~~~~~
/Users/sky/Desktop/AudioKit-4.2.2/AudioKit/Common/Internals/AudioKitHelpers.swift:22:16: error: cannot invoke 'index' with an argument list of type '(Self.Index, offsetBy: Int)'
return index(startIndex, offsetBy: offset)
^
/Users/sky/Desktop/AudioKit-4.2.2/AudioKit/Common/Internals/AudioKitHelpers.swift:22:16: note: expected an argument list of type '(Self.Index, offsetBy: Self.IndexDistance)'
return index(startIndex, offsetBy: offset)
^
/Users/sky/Desktop/AudioKit-4.2.2/AudioKit/Common/Internals/CoreAudio/AudioUnit+Helpers.swift:101:29: error: missing argument for parameter 'capacity' in call
data.deallocate()
^
capacity: <#Int#>
Swift.UnsafeMutablePointer:273:17: note: 'deallocate(capacity:)' declared here
public func deallocate(capacity: Int)
^
/Users/sky/Desktop/AudioKit-4.2.2/AudioKit/Common/Nodes/Effects/Reverb/Convolution/AKConvolution.swift:144:41: error: missing argument for parameter 'capacity' in call
theData?.deallocate()
^
capacity: <#Int#>
Swift.UnsafeMutablePointer:273:17: note: 'deallocate(capacity:)' declared here
public func deallocate(capacity: Int)
^
/Users/sky/Desktop/AudioKit-4.2.2/AudioKit/Common/Nodes/Playback/Phase-Locked Vocoder/AKPhaseLockedVocoder.swift:226:41: error: missing argument for parameter 'capacity' in call
theData?.deallocate()
^
capacity: <#Int#>
Swift.UnsafeMutablePointer:273:17: note: 'deallocate(capacity:)' declared here
public func deallocate(capacity: Int)
^
/Users/sky/Desktop/AudioKit-4.2.2/AudioKit/Common/Nodes/Effects/AudioKit Operation-Based Effect/AKOperationEffect.swift:28:17: error: value of type '[NSNumber]' has no member 'compactMap'
$0.compactMap { $0.doubleValue }
^~ ~~~~~~~~~~
I tried to copy the AudioKit source code into the project I was testing: AudioKit's HelloWorld project. In this case I have the following error on XCode:
/Users/sky/Desktop/AudioKit-4.2.2/AudioKit/Common/Internals/AudioUnit Host/AKAudioUnitManager.swift:140:16: Value of type '[AVAudioUnit?]' has no member 'compactMap'
The error is thrown on source code file AKAudioUnitManager.swift on the method below:
private var linkedEffects: [AVAudioUnit] {
return _effectsChain.compactMap { $0 }
}
Also, playground is not working even with compiled framework.
I use MacOS Sierra, XCode 9.2, Swift 4, iOS 9.2.
Thanks!

Enum initializer as const

Are vala enums not integer based? This example generates a "c" compile error. Not a big deal, but would like to understand why.
const int INT_UNINITIALIZED = 999;
public enum ScopeTypes {
/*OSS:Fix:GLib requires a default value, set GLOBALS = 0
(VSCodeDbgSvr.exe:31979): GLib-GObject-CRITICAL **: g_param_spec_enum: assertion 'g_enum_get_value (enum_class, default_value) != NULL' failed*/
NONE = INT_UNINITIALIZED,
GLOBALS = 0,
ARGUMENTS,
LOCALS,
EXCEPTIONS,
TOT_SCOPE_TYPES;
//Vala enums may have methods:
public bool is_global() {
return (this == GLOBALS || this == EXCEPTIONS);
}
public bool is_function() {
return (this == ARGUMENTS || this == LOCALS);
}
public bool is_valid() {
return (this != NONE);
}
}
The compile output:
> Executing task: /opt/vala/bin/valac helloworld.vala class1.vala --pkg libvala-0.40 -X -I/opt/vala/include/vala-0.40 -X -O0 --vapidir=/opt/vala/share/vala/vapi --debug --save-temps -o helloworld.exe <
/media/george/SharedData/Projects/Vala/Examples/playground-2/helloworld.c:82:21: error: ‘INT_UNINITIALIZED’ undeclared here (not in a function)
SCOPE_TYPES_NONE = INT_UNINITIALIZED,
^~~~~~~~~~~~~~~~~
error: cc exited with status 256
Compilation failed: 1 error(s), 1 warning(s)
The terminal process terminated with exit code: 1
The relevant part of the error message is:
error: ‘INT_UNINITIALIZED’ undeclared here (not in a function)
The C compiler is complaining that it can not find the declaration of your constant. So it is not a type problem at all.
It is a scope / ordering problem.
If you compile the code with valac -C you get a .c file that looks something like this:
typedef enum {
SCOPE_TYPES_NONE = INT_UNINITIALIZED,
SCOPE_TYPES_GLOBALS = 0,
SCOPE_TYPES_ARGUMENTS,
SCOPE_TYPES_LOCALS,
SCOPE_TYPES_EXCEPTIONS,
SCOPE_TYPES_TOT_SCOPE_TYPES
} ScopeTypes;
#define INT_UNINITIALIZED 999
Note how the Vala compiler has reordered the code to declare the enum first and the constant later.
Since in C the order of declarations in a file is important this can not compile.
I would consider this to be a compiler bug and you may want to report this to the GNOME bugtracker (product Vala).

solcover fail to generate test coverage with my simple add contract

I want to use solcover to generate test coverage of my contract.
https://github.com/JoinColony/solcover
I test it with the simple one:
contract Add {
function Add() {
}
function sum(uint x, uint y) returns (uint) {
return (x+y);
}
}
And here is my test code:
contract('Add', function(accounts) {
it("should return 5 when add 2 and 3", function() {
var add = Add.deployed();
return add.sum.call(2,3).then(function(res){
assert.equal(res.valueOf(), 5, "add result is 5");
});
});
});
But there are some errs when compile it.
Add.sol:2:1: Warning: Source file does not specify required compiler version!Consider adding "pragma solidity ^0.4.6
contract Add {
^
Spanning multiple lines.
Compilation failed. See above.
fs.js:549
Then i add compile version like this:
pragma solidity ^0.4.6;
contract Add {
function Add() {
}
function sum(uint x, uint y) returns (uint) {
return (x+y);
}
}
And now it pass the compile. But this time I got the error:
cp: no such file or directory: ./../originalContracts/Migrations.sol
rm: no such file or directory: ./allFiredEvents
Compiling Add.sol...
Contract: Add
✓ should return 5 when add 2 and 3
1 passing (15s)
fs.js:549
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT: no such file or directory, open './allFiredEvents'
at Error (native)
at Object.fs.openSync (fs.js:549:18)
at Object.fs.readFileSync (fs.js:397:15)
at Object.<anonymous> (/Users/maiffany/graduate/mytest/solcover/runCoveredTests.js:60:13)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
And in the runCoveredTests.js I found this:
55:shell.cp("./../originalContracts/Migrations.sol",./../contracts/Migrations.sol");
56:
57:shell.rm('./allFiredEvents'); //Delete previous results
58:shell.exec('truffle test --network coverage');
59:
60:events = fs.readFileSync('./allFiredEvents').toString().split('\n')
I guess maybe it is this command that generate file "allFiredEvents". So i try this in my command line:
truffle test --network coverage
Compiling Add.sol...
Contract: Add
✓ should return 5 when add 2 and 3
1 passing (24s)
But i still can't find the file "allFiredEvents".
So where did i get wrong?

linking QuaZip with Qt 4.8.0 into project

I have a project where I want to unzip files.
I have found Quazip to be close to the implementation I want(check), but....
when build the project the compiler says
Makefile.Release:241: warning: overriding commands for target
release/moc_quazipfile.o' Makefile.Release:219: warning: ignoring
old commands for targetrelease/moc_quazipfile.o'
release\moc_quazipfile.cpp:40: warning: 'static void
QuaZipFile::qt_static_metacall(QObject*, QMetaObject::Call, int,
void**)' redeclared without dllimport attribute: previous dllimport
ignored release\moc_quazipfile.cpp:48: warning:
'QuaZipFile::staticMetaObjectExtraData' redeclared without dllimport
attribute after being referenced with dll linkage
release\moc_quazipfile.cpp:52: warning:
'QuaZipFile::staticMetaObject' redeclared without dllimport attribute
after being referenced with dll linkage
release\moc_quazipfile.cpp:61: warning: 'virtual const QMetaObject*
QuaZipFile::metaObject() const' redeclared without dllimport
attribute: previous dllimport ignored release\moc_quazipfile.cpp:66:
warning: 'virtual void* QuaZipFile::qt_metacast(const char*)'
redeclared without dllimport attribute: previous dllimport ignored
release\moc_quazipfile.cpp:74: warning: 'virtual int
QuaZipFile::qt_metacall(QMetaObject::Call, int, void*)' redeclared
without dllimport attribute: previous dllimport ignored
mingw32-make.exe[1]: Leaving directory `*
**quazip_test-build-desktop-Qt_4_8_0_for_Desktop_-MinGW_Qt_SDK__Release'
release\moc_quazipfile.cpp:48: error: definition of static data
member 'QuaZipFile::staticMetaObjectExtraData' of dllimport'd class
mingw32-make.exe[1]: * [release/moc_quazipfile.o] Error 1
mingw32-make.exe: * [release] Error 2 13:29:01: The process
"C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2. Error while
building project quazip_test (target: Desktop) When executing build
step 'Make'
.pro:
QT += core gui
TARGET = quazip_test
TEMPLATE = app
INCLUDEPATH += C:/QtSDK/QtSources/4.8.0/src/3rdparty/zlib
SOURCES += main.cpp\
mainwindow.cpp \
quazip/quazipnewinfo.cpp \
quazip/quazipfile.cpp \
quazip/quazip.cpp \
quazip/quacrc32.cpp \
quazip/qioapi.cpp \
quazip/moc_quazipfile.cpp \
quazip/JlCompress.cpp \
quazip/quaadler32.cpp
HEADERS += mainwindow.h \
quazip/crypt.h \
quazip/unzip.h \
quazip/quaadler32.h \
quazip/quazipnewinfo.h \
quazip/quazipfileinfo.h \
quazip/quazipfile.h \
quazip/quazip_global.h \
quazip/quazip.h \
quazip/quacrc32.h \
quazip/quachecksum32.h \
quazip/JlCompress.h \
quazip/ioapi.h \
quazip/zip.h
FORMS += mainwindow.ui
mainwindow.h:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "quazip/quazip.h"
#include "quazip/quazipfile.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
mainwindow.cpp:
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QuaZip *temp = new QuaZip();
}
MainWindow::~MainWindow()
{
delete ui;
}
What am I doing wrong??
BR

Resources