Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ios调用plugin方法失败:FairJSBridge.m exceptionValue:ReferenceError: Cannot access uninitialized variable. #137

Open
guyuuan opened this issue Aug 12, 2022 · 7 comments

Comments

@guyuuan
Copy link

guyuuan commented Aug 12, 2022

问题

在ios使用plugin调用dart侧方法报错,在Android可以正常调用

环境信息

提供Fair版本号

dependencies:
  fair: 2.7.0

相关截图【可选】

[Fair]:
	File:FairDartBridge.m, 
	Function:-[FairDartBridge setDartListener]_block_invoke, 
	Line:87 >>
	{"pageName":"plugin_test#0","type":"method","args":{"funcName":"_onPressed","args":null}}
[Fair]:
	File:FairJSBridge.m, 
	Function:-[FairJSBridge context]_block_invoke, 
	Line:220 >>
	exceptionValue:ReferenceError: Cannot access uninitialized variable.
[Fair]:
	File:FairDartBridge.m, 
	Function:-[FairDartBridge setDartListener]_block_invoke_2, 
	Line:92 >>
	undefined
[Fair]:
	File:FairDartBridge.m, 
	Function:-[FairDartBridge setDartListener]_block_invoke_2, 
	Line:96 >>
	undefined
@yancechen
Copy link
Contributor

收到,我们排查一下~

@cuocuo
Copy link

cuocuo commented Aug 18, 2022

同样的问题,请问有解决吗? @yancechen

@yancechen
Copy link
Contributor

还在排查中。

@xiangwc
Copy link
Contributor

xiangwc commented Aug 19, 2022

问题

在ios使用plugin调用dart侧方法报错,在Android可以正常调用

环境信息

提供Fair版本号

dependencies:
  fair: 2.7.0

相关截图【可选】

[Fair]:
	File:FairDartBridge.m, 
	Function:-[FairDartBridge setDartListener]_block_invoke, 
	Line:87 >>
	{"pageName":"plugin_test#0","type":"method","args":{"funcName":"_onPressed","args":null}}
[Fair]:
	File:FairJSBridge.m, 
	Function:-[FairJSBridge context]_block_invoke, 
	Line:220 >>
	exceptionValue:ReferenceError: Cannot access uninitialized variable.
[Fair]:
	File:FairDartBridge.m, 
	Function:-[FairDartBridge setDartListener]_block_invoke_2, 
	Line:92 >>
	undefined
[Fair]:
	File:FairDartBridge.m, 
	Function:-[FairDartBridge setDartListener]_block_invoke_2, 
	Line:96 >>
	undefined

能提供一下出错的代码吗?

@cuocuo
Copy link

cuocuo commented Aug 19, 2022

问题
在ios使用plugin调用dart侧方法报错,在Android可以正常调用
环境信息
提供Fair版本号

dependencies:
  fair: 2.7.0

相关截图【可选】

[Fair]:
	File:FairDartBridge.m, 
	Function:-[FairDartBridge setDartListener]_block_invoke, 
	Line:87 >>
	{"pageName":"plugin_test#0","type":"method","args":{"funcName":"_onPressed","args":null}}
[Fair]:
	File:FairJSBridge.m, 
	Function:-[FairJSBridge context]_block_invoke, 
	Line:220 >>
	exceptionValue:ReferenceError: Cannot access uninitialized variable.
[Fair]:
	File:FairDartBridge.m, 
	Function:-[FairDartBridge setDartListener]_block_invoke_2, 
	Line:92 >>
	undefined
[Fair]:
	File:FairDartBridge.m, 
	Function:-[FairDartBridge setDartListener]_block_invoke_2, 
	Line:96 >>
	undefined

能提供一下出错的代码吗?

大概定位到问题了。fair_jsbase.js文件中有bigint类型在iOS14一下的系统上是不支持的,导致了加载js文件失败。我在iOS15系统上就可以跑通,iOS12的系统就会报错。
https://webkit.org/blog/11340/new-webkit-features-in-safari-14/
https://caniuse.com/bigint
这两个文章都有对bigint的支持有说明!
@zhiqingchen

@cuocuo
Copy link

cuocuo commented Aug 23, 2022

这个可以先用其他类型替换BigInt吗,BigInt类型目前兼容性不好! @yancechen

@LynkKid
Copy link

LynkKid commented Oct 10, 2022

I am also facing the same error, please help me to solve it

Function:-[FairDartBridge setDartListener]_block_invoke,
Line:87 >>
{"pageName":"null#2","type":"method","args":{"funcName":"onBack","args":null}}
Fair:
File:FairJSBridge.m,
Function:-[FairJSBridge context]_block_invoke,
Line:220 >>
exceptionValue:TypeError: undefined is not an object (evaluating 'mClass[funcName]')
Fair:
File:FairDartBridge.m,
Function:-[FairDartBridge setDartListener]_block_invoke_2,
Line:92 >>
undefined
Fair:
File:FairDartBridge.m,
Function:-[FairDartBridge setDartListener]_block_invoke_2,
Line:96 >>
undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants