Polidea / ios-class-guard

Simple Objective-C obfuscator for Mach-O executables.
http://www.polidea.com
1.64k stars 240 forks source link

iOS 9 warnings regarding dylib #49

Open nadiag1234 opened 8 years ago

nadiag1234 commented 8 years ago

Did anyone get these types of warnings - 2015-10-21 14:29:07.544 ios-class-guard[20418:1056995] Warning: Failed to load: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/usr/lib/libobjc.A.dylib 2015-10-21 14:29:07.544 ios-class-guard[20418:1056995] Warning: Couldn't load MachOFile with ID: /usr/lib/libobjc.A.dylib, adjustedID: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/usr/lib/libobjc.A.dylib

With the move from .dylib to .tbd I can understand why we have these warnings, but how come nobody encountered this issue, and if someone did - is there a solution?

junketjim commented 8 years ago

I've also encountered this - when building a target for Generic iOS device as opposed to the simulator. This causes me an issue as the obfuscation creates a different result (number of categories, etc. obfuscated) than my simulator build - resulting in something which will build and link for the simulator but won't for the device.

See here... https://www.reddit.com/r/iOSProgramming/comments/39rcby/ios_9_os_x_1011_xcode_7_development_with_dynamic/

neuralmer commented 8 years ago

@nadiag1234 and @junketjim:

The approach ios-class-guard takes to renaming is clever, but can produce less than intuitive compiler errors when there is a problem. In order for it to work well, the system libraries that your app uses must be analyzed. ios-class-guard will warn you if this fails. With the warnings you describe.

Apple has dramatically changed the SDKs ship with Xcode (6 and again in 7) to reduce download footprints. iPhoneSimulator SDK still works, but the iPhoneOS SDK format is unsupported. This means that analysis of an ARM binary will not work.

Make sure to look for the Forbidden keywords line:

2016-04-25 12:41:45.225 ios-class-guard[2598:64769341] Forbidden keywords = 98

This number should be > 50k for even a simple iOS project. If the number is very small, analysis of the SDK failed, and poor build results can be expected, including error messages like unexpected '@' in program.

We (PreEmptive Solutions) forked iOS Class Guard, creating a new product, called PreEmptive Protection for iOS - Rename (or PPiOS-Rename), that fixes this issue and a number of others.

PPiOS-Rename uses the same approach to renaming, but will use iPhoneSimulator SDK in lieu of iPhoneOS SDK, even for ARM binaries.

Note that PPiOS-Rename changes the way the obfuscation process is integrated into the build (to make it easier to use), so you'll probably need to make changes to your build, and to pay attention to the new/changed argument names.

Please give it a try and let us know how it works for you.