Restore Cocos Creator hot-update search paths during iOS startup so the app loads the updated code after restarting.
This hot-update implementation was already working correctly on Android, so I reused it on iOS without much concern. The update reached 100%, and I was happy when the app restarted—until I realized that it was still running the old code.
Troubleshooting
Common Cocos 3.x issue: point the update path at the assets root
My source path was -s ${path.join(result.dest, resdir)}:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
exports.onAfterBuild = function (options, result) { let resdir = 'assets';
I called setSearchPaths only when the update finished. After the restart, I did not restore those paths early in the game startup process, so iOS continued loading the old code.