ios-class-guard
ios-class-guard copied to clipboard
ViewControllers exclusion
After starting obfuscated project we have a lot of crashes related to ViewController classes (e.g. reference in XIB).
In console log we see symbol which caused the crash. After finding that symbol in "symbols.h" we exclude associated class, as described in section "Undefined symbols" of your README.md.
By repeating this process we manage to get app work properly BUT most of our ViewControllers are now excluded. This means that level of protection is now much lower.
Is there a way to fix problematic symbols without excluding classes?
You can exclude only separate symbols with -i <symbol>
instead of excluding whole classes with -F <class>
. Does it help?
We are using that as well.
But in ViewController crashes symbol (shown in console) is directly associated to class Name (in symbols.h).
Did you try -X <directory>
option? This should replace symbols inside XIB and Storyboard files.
I just rerun obfuscation with -X <directory>
and result is same.
App crashed on symbol w7G
, which is associated to class name of our ViewController.
Crash log is below:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/urosmil/Library/Developer/CoreSimulator/Devices/B31C711C-EE12-4FEC-BC32-43DAA7529411/data/Containers/Bundle/Application/60637756-D8EF-4590-BC11-F5E0B2FB73D2/THE_APP_NAME.app> (loaded)' with name 'w7G''
*** First throw call stack:
(
0 CoreFoundation 0x00000001081a2c65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000107e3bbb7 objc_exception_throw + 45
2 CoreFoundation 0x00000001081a2b9d +[NSException raise:format:] + 205
3 UIKit 0x00000001069a1131 -[UINib instantiateWithOwner:options:] + 552
4 UIKit 0x00000001067f96d8 -[UIViewController _loadViewFromNibNamed:bundle:] + 242
5 UIKit 0x00000001067f9cc8 -[UIViewController loadView] + 109
6 UIKit 0x00000001067f9f39 -[UIViewController loadViewIfRequired] + 75
7 UIKit 0x00000001067fa3ce -[UIViewController view] + 27
8 UIKit 0x000000010681f257 -[UINavigationController _startCustomTransition:] + 633
9 UIKit 0x000000010682b37f -[UINavigationController _startDeferredTransitionIfNeeded:] + 386
10 UIKit 0x000000010682bece -[UINavigationController __viewWillLayoutSubviews] + 43
11 UIKit 0x00000001069766d5 -[UILayoutContainerView layoutSubviews] + 202
12 UIKit 0x00000001067499eb -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 536
13 QuartzCore 0x0000000106038ed2 -[CALayer layoutSublayers] + 146
14 QuartzCore 0x000000010602d6e6 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
15 QuartzCore 0x000000010602d556 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
16 QuartzCore 0x0000000105f9986e _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
17 QuartzCore 0x0000000105f9aa22 _ZN2CA11Transaction6commitEv + 462
18 QuartzCore 0x0000000105f9b0d3 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 89
19 CoreFoundation 0x00000001080d5ca7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
20 CoreFoundation 0x00000001080d5c00 __CFRunLoopDoObservers + 368
21 CoreFoundation 0x00000001080cba33 __CFRunLoopRun + 1123
22 CoreFoundation 0x00000001080cb366 CFRunLoopRunSpecific + 470
23 GraphicsServices 0x000000010c3bfa3e GSEventRunModal + 161
24 UIKit 0x00000001066c98c0 UIApplicationMain + 1282
25 PasswordBoss 0x00000001048cdc17 main + 151
26 libdyld.dylib 0x00000001089ca145 start + 1
27 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
How do you load your ViewController?
There is macro for this:
#define PUSH_VC(Class) [self.navigationController pushViewController:[[Class alloc] initWithNibName:NSStringFromClass([Class class]) bundle:nil] animated:YES]
And it's used in following way:
PUSH_VC(ClassName)
Guys, do you have any new idea about this issue?
We are not able to reproduce it. Could you please isolate the issue and attach the project that we can use to replicate it?