You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
require('JPEngine').addExtensions(['JPBlock']);defineClass('JPViewController',{viewDidLoad: function(){self.ORIGviewDidLoad()self.prepareEnv();},prepareEnv: function(){self.ORIGprepareEnv();// Define block with JSvartempBlock=block('BOOL, NSString *',function(message){console.log("Block from JS and set in 'prepareEnv' get called with message "+message.toJS())})self.setSimpleBlock(tempBlock)// Case 1: // self.currentSimpleBlock()("Calling in prepareEnv")// Case 2:varsimpleBlockFromOC=self.simpleBlock();simpleBlockFromOC("Calling in prepareEnv");},handleSecondBtn: function(sender){vartheBlock=self.simpleBlock();theBlock("Calling from JS");},})
2018-06-27 18:18:31.698 JSPatchDemo[1757:317836] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSMethodSignature signatureWithObjCTypes:]: type signature is empty.'
*** First throw call stack:
(0x181f2adb0 0x18158ff80 0x181e274fc 0x185a468b4 0x1859ed604 0x1859ede54 0x185987774 0x1859e3f10 0x1859e046c 0x185a47e40 0x185a45f70 0x185a45af8 0x185a46cf0 0x1855ee518 0x185a2d9f8 0x185a2d9a0 0x185a2da04 0x185a2dbd4 0x185a27b98 0x1859536bc 0x1855f226c 0x1855f201c 0x1859e231c 0x1000731f0 0x181f2ea1c 0x181e2cc5c 0x100096454 0x1870c0be8 0x1870c0b64 0x1870a8870 0x1870c0454 0x1870c0084 0x1870b8c20 0x18708904c 0x187087628 0x181ee109c 0x181ee0b30 0x181ede830 0x181e08c50 0x1836f0088 0x1870f2088 0x10009fec8 0x1819a68b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
与此同时,如果成功启动,点击按钮 Exec simpleBlock in JS 有时候还可以出现 Exception:
Printing description of log:
js exception,
msg: simpleBlockFromOC is not a function. (In 'simpleBlockFromOC("Calling in prepareEnv")', 'simpleBlockFromOC' is an instance of Object),
stack:
[email protected]:22:73
JSPatch.js:169:27
[native code]
[email protected]:6:27
JSPatch.js:153:41
关于机型和系统
在 iPhone6 Plus iOS 9.9.3 上, 重现几率极大
在 iPhoneX iOS 11.3.1 上,重现几率比较小,一般能正常启动,但不断点击按钮 Exec simpleBlock in JS ,大概20次内,也能重现。
概述
最近在研究JSPatch,在尝试 Extension 'JPBlock' 的时候,发现一些问题。而且这些问题的出现是有一定几率的。
重现
使用最新的 Master 上的代码,打开
JSPatchDemo.xcodeproj
修改
JPViewController
的代码如下同时修改
demo.js
然后运行,app 有可能一启动就出现崩溃,如果没有崩溃,点击多几次 “Prepare Environment” 按钮,也可能出现同样的崩溃。
与此同时,如果成功启动,点击按钮
Exec simpleBlock in JS
有时候还可以出现 Exception:关于机型和系统
在 iPhone6 Plus iOS 9.9.3 上, 重现几率极大
在 iPhoneX iOS 11.3.1 上,重现几率比较小,一般能正常启动,但不断点击按钮
Exec simpleBlock in JS
,大概20次内,也能重现。疑问
@bang590 这个是不是说明,
JPBlock
还不完全支持“block 从JS传到OC,在传回JS,并执行”的情况?还是哪里的代码写得有问题?问题的出现是随机的,这种随机性,感觉跟资源释放有关,或者跟内存地址被污染有关?
The text was updated successfully, but these errors were encountered: