uniapp code obfuscation issue 43 on iOS

Reference article:uniapp packages ios apk, obfuscates the code_uniapp obfuscation_yogurt free blog with the same name-CSDN blog

When uniapp is packaged for ios and uploaded to the ios application market, it will fail to pass the review because of 4.3 (code duplication rate is too high). At this time, you can pass the review by obfuscating the code.

1. Project terminal installation plug-in

npm install javascript-obfuscator -g

2. You can check whether the installation is successful by checking the plug-in version number.

javascript-obfuscator -v

3. Create a build.bat script file in the root directory of the project (I created it in the root directory of the unpackage file)


4. The content of the build.bat file is

C:
javascript-obfuscator C:\Users\zy\Desktop\xiangmu\demo\unpackage\dist\build\mp-weixin\pages --output C:\Users\zy\Desktop\xiangmu\demo\unpackage\dist\build\mp-weixin\pages && javascript-obfuscator C:\Users\zy\Desktop\xiangmu\demo\unpackage\dist\build\mp-weixin\components --output C:\Users\zy\Desktop\xiangmu\demo\unpackage\dist\build\mp-weixin\components 

The code means 

文件夹此文件混淆代码 C:\Users\zy\Desktop\xiangmu\demo\unpackage\dist\build\mp-weixin\pages 输出到以下文件 C:\Users\zy\Desktop\xiangmu\demo\unpackage\dist\build\mp-weixin\pages  并且文件夹此文件混淆代码 javascript-obfuscator C:\Users\zy\Desktop\xiangmu\demo\unpackage\dist\build\mp-weixin\components 输出到以下文件 C:\Users\zy\Desktop\xiangmu\demo\unpackage\dist\build\mp-weixin\components

If the output file is the same as the source file, the source file will be overwritten. If the code of other files is also confused, just write it directly after &&

Mine is the uview component library in the obfuscation project code. I copied a project specifically for obfuscation.

D:
javascript-obfuscator D:\code\ganluhua\uniapp\hunxiao\uview-ui --output D:\code\ganluhua\uniapp\hunxiao\uview-ui && javascript-obfuscator D:\code\ganluhua\uniapp\hunxiao\request --output D:\code\ganluhua\uniapp\hunxiao\request

5. Double-click the build.bat file and the obfuscation file will be output to indicate successful obfuscation.

ps: It is best to double-click directly in the file

6. If this command pop-up box appears, the obfuscation is successful. After the obfuscation is completed, the command pop-up window will be closed automatically.

But we also encountered some problems

1. The first time it was put on the shelf, it passed, but the second time I still reported the 4.3 problem.

Reason and solution: Execute build.bat several times to see if it works

おすすめ

転載: blog.csdn.net/weixin_40918145/article/details/132872905