ios-class-guard
ios-class-guard copied to clipboard
Cannot compile the app after obfuscation when using Xcode 7
I tried to compile the app after obfuscation by using Xcode 7 GM but compile fails with lot of errors. See few example errors below.
error: use of undeclared identifier 'k1r' self.view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6];
error: no known class method for selector 'colorWithWhite:k7G:' self.view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6];
error: no visible @interface for 'UIViewController' declares the selector 'b50' [super didReceiveMemoryWarning];
Any glue or plans for Xcode 7 support?
Hi there! Did you manage to solve this issue somehow? Having same problem and still no luck...
I have some debuging results. It turns out that after xcode update list of ibfuscated symbolg grows a lot and includes symbols belonging to iOS SDK itself making mess.
The question is how Xcode 7 changed building symbols lists and why it includes now much more of them.
I have same problem under XCode 7.0 I got hundreds
DTAlertView/DTAlertView.h:27:1: unexpected '@' in program
@class DTAlertView;
Everything about DTAlert will cause problems. It wasn't a problem in XCode 6.x.
Now, I am trying to ignore DTAlert in Bash, but the same errors keep popped up.....
I am facing the same issue. After obfuscation, it is showing errors everywhere in the project. Any luck guys solving this? Please let me know.
Updated today to XCode 7.0.1, and I'm getting the same errors. How to fix it?
We've just release new (0.8) version of iOS Class Guard which, we hope, solves Xcode7 issues. Please upgrade iOS Class Guard and let us know about results.
This version 0.8 is working very well with XCode 7.0
Thanks a lot for that fix. Works like a charm :)
bumped up to Xcode 7.2 today and everything started failing after obfuscation.
Expected an Objective-C directive after '@'
and the actual line of code is just
@property (nonatomic, assign) BOOL enabled;
I'm getting the same errors that "Expected an Objective-C directive after '@'". How to fix it?
Am facing the same issue with xCode 7.1.1 and xCode 7.2. How to fix it ?
@Mohamed3amer Did you fix it now?Am so confuse about it.
@lin493369 No :( , I tried to exclude the external libraries and the pods libraries from obfuscation but i still facing issues. I posted another issue here https://github.com/Polidea/ios-class-guard/issues/55#issuecomment-185082608.
I have the latest version of the library and still having unexpected '@' in program
error under Xcode7 working with a workspace that gathers my project and Pods.
Any solutions?
Facing the same issue at xcode7.3. Is there any workaround proposed from the Polidea team? Or simply giving more information on why there are tons of "unexpected '@' in program" at new xcode?
I can try to help. Thanks.
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. Pay attention to warnings like the following:
2016-04-25 12:41:44.173 ios-class-guard[2598:64769341] Warning: Failed to load: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuartzCore.framework/QuartzCore
2016-04-25 12:41:44.174 ios-class-guard[2598:64769341] Warning: Couldn't load MachOFile with ID: /System/Library/Frameworks/QuartzCore.framework/QuartzCore, adjustedID: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuartzCore.framework/QuartzCore
2016-04-25 12:41:44.174 ios-class-guard[2598:64769341] Warning: Failed to load: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
2016-04-25 12:41:44.174 ios-class-guard[2598:64769341] Warning: Couldn't load MachOFile with ID: /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics, adjustedID: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
This means that ios-class-guard is not able to analyze the dependencies correctly. 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. Cocoapods should work fine, so long as they are open-source (e.g. they are compiled as part of your build), and not pulled down as compiled static libraries. Closed-source Cocoapods will need to be excluded with something like:
ppios-rename --analyze -F '!CSC*' path/to/your.app
This will exclude all classes, etc. starting with "CSC" ("Closed-Source Cocoapod").
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.