An issue with automatic deletion of files in iOS

An issue with automatic deletion of files in iOS.

Hello developer friends. I’m developing a game this time and preparing for iOS release. Cocos Creator has experienced once again that it is a very great engine. Trust me.

There was one problem while developing IOS this time, and we added BridgeUtil.h and mm files to our game project, but the files are removed every time we build in Cocos Creator Inspector. Automatically. It’s cumbersome to add each time.

Does anyone know how to solve this?

These two files currently exist in the engine/ios folder and I add them to the Source Files folder in project name + mobile, but the script disappears every time I build. Of course the framework. We’re using the Facebook Framework, and they’re adding it back every time.

you can add BridgeUtil.h and mm files to CMakeList.txt

I tried the code you gave me. I put it as follows, but automatic import still does not work… Android did not have this problem, but IOS is a bit difficult.

image

which version of creator are you using? i think you may add this two files to CMakeList.txt after what i pointed before.

I’m currently using cocos version 3.5.1. So you mean to add text after build?

i mean to add in this line, after the ViewController.h:

This is all the code I get when I open the CMAKELIST file. Is the version you are using different from the one you are using? I want to do the same as you advised, but the code is different. Of course, this code doesn’t work now.

why you put this two files in project name + mobile? can you show Facebook Framework you used? i put this two files in engine/ios and it exists after build.

Oh I also put the file in engine/ios. The problem is not that the file is physically deleted, but that it is excluded from the project and has to be added every time.

what you mean of excluded from the project? and where you added it?

I found the answer. The problem was where I put the code. It was solved by adding it to the HERE section below.

include(${CC_PROJECT_DIR}/…/common/CMakeLists.txt)
set(EXECUTABLE_NAME ${APP_NAME})

cc_ios_before_target(${EXECUTABLE_NAME})


-------------------------------------HERE
list(APPEND CC_ALL_SOURCES
${CMAKE_CURRENT_LIST_DIR}/BridgeUtil.h
${CMAKE_CURRENT_LIST_DIR}/BridgeUtil.mm
)


add_executable(${EXECUTABLE_NAME} ${CC_ALL_SOURCES})
cc_ios_after_target(${EXECUTABLE_NAME})