Problem when changes files in cocos2d-x jsb 2.2.2

I have a project created with cocos2d-x using javascript, it works perfectly.

So, I created a javascript project using the ‘tools/project-creator/create_project.py’ .

For default, the project runs a file called ‘cocos2d-jsb.js’ through the following script.

ScriptingCore::getInstance()->runScript("cocos2d-jsb.js");

But I want to create another name for this file, like ‘main.js’ to run the script this way

ScriptingCore::getInstance()->runScript("main.js");

I add the file to xcode, I run the project, the project compile successfully, but I receive the following error:

Cocos2d: JS: :0:can't open main.js: No such file or directory

Any idea how resolve that, I’ll appreciate any help.

Hi, @fabiobh

You need to add your file into build phase of your project, then it can be found: Xcode project -> Build Phases -> Copy Bundle Resources -> add your main.js

Huabin

Hi @pandamicro

It works for me now, thank you so much for your help!