我想使用SwiftShield混淆Swift代码。我已经使用Cocoapods进行了整合。

要运行它,我在终端中使用下面的SwiftShield工具:

swiftshield -automatic -project-root /app/MyApp -automatic-project-file
/app/MyApp/MyApp.xcworkspace -automatic-project-scheme MyApp-AppStore

出现错误:
-bash: swiftshield: command not found

我已经将swiftshield可执行文件从Pod复制到/ usr / local / bin并尝试了相同的命令,但是仍然出现以下错误
dyld: Library not loaded: @rpath/sourcekitd.framework/Versions/A/sourcekitd
Referenced from: /usr/local/bin/swiftshield
Reason: image not found
Abort trap: 6

可能是什么问题?如何安装SwiftShield

最佳答案

问题与Xcode路径有关。我的机器上安装了2个Xcode版本。

/Applications/Xcode10.3.1.app

/应用程序/Xcode11.1.app

我删除了 Xcode10.3.1.app ,并将 Xcode11.1.app 重命名为 Xcode.app 。问题已解决。
https://github.com/rockbruno/swiftshield/issues/71#event-2832206369

使用swiftshield(手动模式)的步骤:

  • 在桌面上下载swiftshield可执行文件
    https://github.com/rockbruno/swiftshield/releases
  • 命令行-转到桌面并授予可执行权限
  • sudo chmod 755 swiftshield
    
  • 将swiftshield可执行文件移至/ usr / bin
  • sudo cp swiftshield /usr/local/bin
    
  • 检查是否已正确安装
  • swiftshield --help
    
  • 更改项目根文件夹的权限,以重命名混淆的代码
  • chmod -R 774 ./ProjectRootDir
    
  • 使用手动模式混淆代码
  • swiftshield -project-root ./ProjectRootDir -tag __obf -verbose
    

    10-08 12:25