问题
I want to obfuscate Swift code using SwiftShield. I have integrated using Cocoapods.
To run it, I am using below SwiftShield tool in terminal:
swiftshield -automatic -project-root /app/MyApp -automatic-project-file
/app/MyApp/MyApp.xcworkspace -automatic-project-scheme MyApp-AppStore
Getting error:
-bash: swiftshield: command not found
I have copied swiftshield executable from pods to /usr/local/bin and tried the same command, but still getting below error
dyld: Library not loaded: @rpath/sourcekitd.framework/Versions/A/sourcekitd
Referenced from: /usr/local/bin/swiftshield
Reason: image not found
Abort trap: 6
What could be the issue? How to install SwiftShield
回答1:
Issue was related with Xcode path. I had 2 Xcode versions were installed on my machine.
/Applications/Xcode10.3.1.app
/Applications/Xcode11.1.app
I deleted Xcode10.3.1.app and renamed Xcode11.1.app to Xcode.app. Issue got resolved now. https://github.com/rockbruno/swiftshield/issues/71#event-2832206369
Steps to use swiftshield(Manual mode):
- Download swiftshield executable on desktop https://github.com/rockbruno/swiftshield/releases
- Command line - Go to desktop and give executable permission
sudo chmod 755 swiftshield
- Move swiftlint to /usr/bin
sudo cp swiftshield /usr/local/bin
- Check if it is installed properly
swiftshield --help
- Change permission of project root folder in order to rename obfuscated code
chmod -R 774 ./ProjectRootDir
- Obfuscate code using manual mode
swiftshield -project-root ./ProjectRootDir -tag __obf -verbose
来源:https://stackoverflow.com/questions/54304648/swiftshield-obfuscation-using-swiftshield-gives-error