使用 iOS ClassGuard 混淆 iOS 项目

Obfuscate iOS project using iOS ClassGuard

如何使用 iOS ClassGuard 项目混淆 iOS 项目: https://github.com/Polidea/ios-class-guard

我正在使用这个项目来混淆我的 iOS 项目。不幸的是,它不工作,抛出错误。

我按照如何使用它提供的步骤操作。但是,当我在做

bash obfuscate_project

构建成功,但之后崩溃了。这是报告:

ios-class-guard[57105:1897397] *** Terminating app due to uncaught

exception 'NSInvalidArgumentException', reason: 'working directory doesn't exist.'

*** First throw call stack: ( 0 CoreFoundation 0x00007fff856ad03c __exceptionPreprocess + 172 1 libobjc.A.dylib

0x00007fff88bf876e objc_exception_throw + 43 2 CoreFoundation

0x00007fff856aceed +[NSException raise:format:] + 205 3 Foundation

0x00007fff86d682a6 -[NSConcreteTask launchWithDictionary:] + 582 4

ios-class-guard 0x000000010f1db7d6

-[CDSystemProtocolsProcessor systemProtocolsSymbolsToExclude] + 534 5 ios-class-guard 0x000000010f1977e2 main + 6110 6

libdyld.dylib 0x00007fff8b4275c9 start + 1 )

libc++abi.dylib: terminating with uncaught exception of type

NSException obfuscate_project: line 28: 57105 Abort trap: 6

"$@"

请告诉我如何解决这个问题。

Fixed this issue following these steps:

What to change while obfuscation:

1. cd project folder path

2. Download iOS ClassGuard project.
curl -o obfuscate_project https://raw.githubusercontent.com/Polidea/ios-class-guard/master/contrib/obfuscate_project && chmod +x obfuscate_project

3. change mode:
chmod +x obfuscate_project

4. Open obfuscate_project in text editor
change following things:

From...

PROJECT=YourProject.xcodeproj
SCHEME=YourScheme
CONFIGURATION=Release
SDK=7.1


From...
"--sdk-root /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator$SDK.sdk"

To...

"--sdk-root /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk"


5. bash obfuscate_project
This will start building the project and after that it will obfuscate.
Two files will be created: 1. symbols.h and 2. symbols.json
pch file will be modified

But after obfuscating, the project is not compiling. 
It is throwing error: 

> Use of undeclared identifier

修复了这个问题。我采取的解决此问题的步骤是:

  1. 在项目中添加"symbols.h"文件。

  2. 在您的 .pch 文件中导入 "symbols.h" 文件。

  3. 仅为发布模式添加 "symbols.h" 文件,像这样导入该文件:

    ifndef 调试

    #import "symbols.h"
    

    endif

  4. 现在为任何项目编译项目 - "Debug" 或 "Release" 模式。一切正常,没有错误。

希望对大家有所帮助。