【发布时间】:2021-05-12 21:34:59
【问题描述】:
我正在尝试从 Swift 本机代码返回一个布尔值,但是它没有返回布尔值,而是返回一个包含我的设备的 iOS 版本并向我显示错误的字符串 -
Unhandled Exception: type 'String' is not a subtype of type 'bool' in type cast
这是我的飞镖代码导致问题的地方
static Future<bool> isLoaded() async {
return _channel.invokeMethod("isLoaded");
}
这是 iOS Swift 原生代码:
case "isLoaded":
result(self.p.isContentReady) //returns a bool true or false
break;
这就是我要打印的布尔值 -
print(await Tapjoy.isLoaded()) //returns iOS 14.4 as a 'String' instead of true/false
【问题讨论】: