使用iOS ClassGuard

时间:2015-09-25 05:41:52

标签: ios objective-c iphone obfuscation xcode7

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

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

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

bash obfuscate_project

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

  

ios-class-guard [57105:1897397] ***由于未被捕获而终止应用程序

     

异常'NSInvalidArgumentException',原因:'工作目录   不存在。'

     

***第一次抛出调用堆栈:(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:以

类型的未捕获异常终止      

NSException obfuscate_project:第28行:57105中止陷阱:6

     

“$ @”

请告诉我如何解决此问题。

2 个答案:

答案 0 :(得分:1)

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 :(得分:0)

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

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

  2. 在.pch文件中导入“symbols.h”文件。

  3. 仅为发布模式添加“symbols.h”文件,导入该文件如下:

    ifndef DEBUG

    #import "symbols.h"
    

    ENDIF

  4. 现在编译项目的任何内容 - “调试”或“发布”模式。一切正常,没有错误。

  5. 希望它有所帮助。