Exclusions
Exclusions let you prevent specific symbols from being obfuscated. This is essential for symbols that must retain their original names at runtime, such as classes accessed via reflection or Interface Builder outlets.
How Exclusions Work
When you exclude a symbol, Shield preserves its original name in the protected binary. Exclusions apply to symbol renaming and do not affect other protections like string encryption or runtime protections.
Exclusions are configured in the symbol_renaming section of your configuration file using wildcard patterns.
Automatic Exclusions
Shield automatically preserves symbols that must not be renamed. You do not need to add these manually.
Apple frameworks: UIKit, SwiftUI, Foundation lifecycle methods are always preserved.
Objective-C runtime symbols: Classes, protocols, and selectors found in ObjC metadata sections are excluded.
Third-party libraries: Classes with known SDK prefixes are excluded automatically using startswith matching:
| Prefix | Library |
|---|---|
FIR, GUL, GTM, GDT, GSD, GAD | Firebase / Google |
FB, FBSDK | Facebook SDK |
CLS, Crashlytics | Crashlytics |
GAI | Google Analytics (legacy) |
nanopb_ | nanopb (Firebase dependency) |
AF | Alamofire ObjC bridge |
SD | SDWebImage |
Realm | Realm |
RCT, RN | React Native |
Flipper | Flipper debugger |
Amplitude | Amplitude analytics |
Sentry | Sentry crash reporting |
DD | Datadog |
Braze | Braze push notifications |
Adjust | Adjust attribution |
Appsflyer, AppsFlyerLib | AppsFlyer |
Stripe, STP | Stripe payments |
IQKeyboard | IQKeyboardManager |
Custom Exclusions
Shield provides two mechanisms for custom exclusions: wildcard patterns (exclude) and substring patterns (exclude_patterns).
Wildcard Patterns (exclude)
Add exclusion patterns to the exclude array in your symbol_renaming configuration:
{
"protections": {
"symbol_renaming": {
"enabled": true,
"exclude": [
"AppDelegate",
"SceneDelegate",
"*Delegate",
"*ViewController",
"*.xib",
"*.storyboard"
]
}
}
}{
"protections": {
"symbol_renaming": {
"enabled": true,
"exclude": [
"AppDelegate",
"SceneDelegate",
"*Delegate",
"*ViewController",
"*.xib",
"*.storyboard"
]
}
}
}Pattern Syntax
Exclusion patterns support wildcards:
| Pattern | Matches |
|---|---|
AppDelegate | Exact match for AppDelegate |
*Delegate | Any symbol ending in Delegate |
My* | Any symbol starting with My |
*View* | Any symbol containing View |
Common Exclusions
Interface Builder
If your application uses Storyboards or XIB files, exclude view controllers and outlets that are referenced by name:
{
"exclude": [
"*ViewController",
"*TableViewCell",
"*CollectionViewCell"
]
}{
"exclude": [
"*ViewController",
"*TableViewCell",
"*CollectionViewCell"
]
}Codable and Serialization
Classes that conform to Codable or use NSCoding need their property names preserved for serialization:
{
"exclude": [
"*Model",
"*Response",
"*Request"
]
}{
"exclude": [
"*Model",
"*Response",
"*Request"
]
}Objective-C Bridging
Symbols accessed from Objective-C via @objc annotations or bridging headers should be excluded:
{
"exclude": [
"*Bridge*",
"*Delegate"
]
}{
"exclude": [
"*Bridge*",
"*Delegate"
]
}Third-Party SDKs (Wildcard)
If you use third-party SDKs that reference your classes by name (such as analytics, crash reporting, or deep linking), exclude those entry points:
{
"exclude": [
"AppDelegate",
"SceneDelegate",
"*Handler"
]
}{
"exclude": [
"AppDelegate",
"SceneDelegate",
"*Handler"
]
}SDK Substring Patterns (exclude_patterns)
For third-party libraries not in the automatic exclusions list, use exclude_patterns for substring-based matching. This is useful when you want to exclude all symbols from an entire SDK by its naming convention:
{
"protections": {
"symbol_renaming": {
"enabled": true,
"exclude_patterns": ["PepeAnalytics", "AcmeSDK", "MyInternalLib"]
}
}
}{
"protections": {
"symbol_renaming": {
"enabled": true,
"exclude_patterns": ["PepeAnalytics", "AcmeSDK", "MyInternalLib"]
}
}
}Custom patterns use substring matching - "Pepe" excludes PepeAnalytics, PepeTracker, and MyPepeHelper.
exclude vs exclude_patterns
Use exclude for wildcard matching on specific symbol names (e.g., "*ViewController", "AppDelegate"). Use exclude_patterns for substring matching on SDK prefixes and library names (e.g., "MySDK", "CustomAnalytics"). Both can be used together.
Granular Exclusions
You can control which symbol types are renamed independently:
{
"symbol_renaming": {
"enabled": true,
"rename_classes": true,
"rename_methods": true,
"rename_properties": true,
"rename_protocols": false,
"exclude": ["AppDelegate", "SceneDelegate"]
}
}{
"symbol_renaming": {
"enabled": true,
"rename_classes": true,
"rename_methods": true,
"rename_properties": true,
"rename_protocols": false,
"exclude": ["AppDelegate", "SceneDelegate"]
}
}Setting rename_protocols to false preserves all protocol names, which is useful when protocols are referenced by name at runtime.
String Encryption Exclusions
You can also exclude specific strings from encryption:
{
"string_encryption": {
"enabled": true,
"exclude": [
"http://*",
"https://*",
"ftp://*"
]
}
}{
"string_encryption": {
"enabled": true,
"exclude": [
"http://*",
"https://*",
"ftp://*"
]
}
}This is useful for URL strings that need to remain readable for network debugging or analytics tools.
Related
- Symbol Renaming - How symbol renaming works
- Configuration Reference - Full configuration options
- Troubleshooting - Common issues with exclusions