require文件jsb_polyfill报错 JSEvaluateScript执行失败

我是将creator项目嵌入到ios中,第一次进入显示正常,退出后释放AppDelegate;然后再次进入加载jsb_polyfill报错,错误如下:TypeError: null is not an object (evaluating ‘cc.textureCache._textures = {}’),TypeError: undefined is not an object (evaluating ‘cc._widgetManager.init’), 我debug调试了下发现result = JSEvaluateScript(_cx, jsScript, nullptr, jsSourceUrl, 1, &exception);在require的时候,这个函数会执行失败,请问有没有人遇到这种情况?

@panda 能帮忙看下问题么?creator1.10.1,ios 11.4.1

这是一些log:
2019-06-11 15:49:20.570198+0800 TestMyMaxSDK[3549:1598171] [DYMTLInitPlatform] platform initialization successful
2019-06-11 15:49:22.896978+0800 TestMyMaxSDK[3549:1598042] onClickLoginBtn

{
gl.supports_OES_map_buffer: true
gl.supports_vertex_array_object: true
cocos2d.x.version: 1.10.0
gl.vendor: Apple Inc.
gl.supports_PVRTC: true
gl.renderer: Apple A8 GPU
cocos2d.x.compiled_with_profiler: false
gl.version: OpenGL ES 2.0 Apple A8 GPU - 112.17.1
gl.max_texture_size: 4096
gl.supports_ETC1: false
gl.supports_BGRA8888: false
cocos2d.x.build_type: DEBUG
gl.max_texture_units: 8
gl.max_samples_allowed: 4
gl.supports_OES_packed_depth_stencil: true
gl.supports_NPOT: true
gl.supports_discard_framebuffer: true
cocos2d.x.compiled_with_gl_state_cache: true
gl.supports_OES_depth24: true
}

Initializing JavaScriptCore
cocos2d: fullPathForFilename: No file found at script/jsb_prepare.jsc. Possible missing file.
cocos2d: fullPathForFilename: No file found at script/jsb_boot.jsc. Possible missing file.
(lldb) po jsSourceUrl
0x000000010a559288

(lldb) po jsScript
0x000000010a5592a0

JS: maxcgFramework load
2019-06-11 15:51:45.448461+0800 TestMyMaxSDK[3549:1598042] cocos2d: surface size: 1242x2208
JS: Create unpacker 0723291fd for aadbkyEPlCwJk6AXOAEQvv
JS: Create unpacker 09a870c74 for 19c++LFzBLgb3k3doGSUhV
JS: Create unpacker 01416d3f8 for e8KpTw6WtHkaFtLj4I0/x5
JS: Create unpacker 0d73f5328 for 97dSCFY9FCsIo1XGnsfpWZ
JS: LoadScene b90pd1JIpKmYzZDyvhzpud: 305.2360000000044ms
JS: I: 2.216999999975087ms
JS: AR: 0.510999999998603ms
JS: D: 0.29199999998672865ms
JS: Success to load scene: db://assets/Scene/StudyScene.fire
JS: AP: 0.01900000000023283ms

ScriptEngine::cleanup begin …
GC begin …, (Native -> JS map) count: 783
XMLHttpRequest_finalize, 0x109d84c60 …
XMLHttpRequest_finalize, 0x102eface0 …
XMLHttpRequest_finalize, 0x109d881e0 …
GC end …, (Native -> JS map) count: 565
GC begin …, (Native -> JS map) count: 565
GC end …, (Native -> JS map) count: 565
GC begin …, (Native -> JS map) count: 565
GC end …, (Native -> JS map) count: 565
Starting to cleanup dragonbones object, count: 0
After first cleanup, dragonbones object remained count: 0
After second cleanup, dragonbones object remained count: 0
ScriptEngine::cleanup end …
2019-06-11 15:51:50.330177+0800 TestMyMaxSDK[3549:1598042] onClickLoginBtn

{
gl.supports_OES_map_buffer: true
gl.supports_vertex_array_object: true
cocos2d.x.version: 1.10.0
gl.vendor: Apple Inc.
gl.supports_PVRTC: true
gl.renderer: Apple A8 GPU
cocos2d.x.compiled_with_profiler: false
gl.version: OpenGL ES 2.0 Apple A8 GPU - 112.17.1
gl.max_texture_size: 4096
gl.supports_ETC1: false
gl.supports_BGRA8888: false
cocos2d.x.build_type: DEBUG
gl.max_texture_units: 8
gl.max_samples_allowed: 4
gl.supports_OES_packed_depth_stencil: true
gl.supports_NPOT: true
gl.supports_discard_framebuffer: true
cocos2d.x.compiled_with_gl_state_cache: true
gl.supports_OES_depth24: true
}

Initializing JavaScriptCore
ERROR: TypeError: null is not an object (evaluating ‘cc.textureCache._textures = {}’), location: src/jsb_polyfill.js:23357:16
STACK:
src/jsb_polyfill.js:23357:16
s@src/jsb_polyfill.js:20:5
src/jsb_polyfill.js:21:9
src/jsb_polyfill.js:21260:2
s@src/jsb_polyfill.js:20:5
src/jsb_polyfill.js:26:37
src/jsb_polyfill.js:27:3
global code@src/jsb_polyfill.js:23871:3
require@[native code]
main.js:214:16
global code@main.js:239:3
[ERROR] Failed to invoke require, location: /Applications/CocosCreator.app/Contents/Resources/cocos2d-x/cocos/scripting/js-bindings/manual/jsb_global.cpp:231
ERROR: TypeError: undefined is not an object (evaluating ‘cc._widgetManager.init’), location: src/jsb_polyfill.js:22125:18
STACK:
sharedInit@src/jsb_polyfill.js:22125:18
prepare@src/jsb_polyfill.js:22761:23
run@src/jsb_polyfill.js:22780:13
boot@main.js:187:20
main.js:215:13
global code@main.js:239:3
2019-06-11 15:51:50.687774+0800 TestMyMaxSDK[3549:1598042] cocos2d: surface size: 1242x2208

@panda @jare 帮忙看下问题吧。

@kenshin 很着急啊,能帮看下问题吗?

好啦, 结贴,问题找到已修改。
原因是调用cocos2d::Director::getInstance()->end()后,引擎里面调用了release,还是他的引用计数为2,director没有被释放导致有些数据出错。
解决办法:就是判断引用计数来release。