Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obfuscation fails on Xcode 7.2 #52

Open
n8stowell82 opened this issue Dec 9, 2015 · 4 comments
Open

Obfuscation fails on Xcode 7.2 #52

n8stowell82 opened this issue Dec 9, 2015 · 4 comments

Comments

@n8stowell82
Copy link

I am trying to obfuscate my project and I am getting tons of errors in the process

While building module 'Darwin' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKitDefines.h:8:
In file included from <module-includes>:1:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/usr/include/sys/cdefs.h:707:2: error: 
      Unsupported architecture
# error Unsupported architecture```

I assume that this is just too new a version of Xcode? or am I missing something else?  thanks in advance for any help
@n8stowell82
Copy link
Author

so after looking a bit more at the specific error it seems it has to do with the fact that it is using the iphonesimulator sdk to compile. After I switched that out to use the iphonos sdk it all started working....mostly.

now the obfuscation completes perfectly, but I cannot build the app I have around 20 errors all saying the same thing:
Expected an Objective-C directive after '@'
when the code is as simple as
@property (nonatomic, assign) BOOL enabled;

@daushn
Copy link

daushn commented Jan 28, 2016

I have the same problem. Did you solve this issue?

@n8stowell82
Copy link
Author

No unfortunately not. I emailed the team to see if they could provide any more insight into the problem and when/if there was going to be a fix. Apparently they are waiting for Apple to release a new ClassDump that is compatible with Xcode 7.2 Who knows when that will happen if even at all.

@neuralmer
Copy link

@n8stowell82:

While I don't know the cause of your original issue, I do know the cause of your second issue: the build failing with iPhoneOS SDK.

@daushn, you are likely encountering this same issue.

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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants