This document outlines the steps needed to properly implement the backdoor functionality while avoiding build issues. The original implementation encountered dependency conflicts and optimization issues during compilation, which this guide aims to address.
-
Swift Package Dependencies
- Conflicting versions of crypto libraries (OpenSSL vs. swift-nio-ssl)
- Newer Swift package versions incompatible with project configuration
- Too many dependencies causing compilation bloat
-
Swift Optimization Levels
- Release configuration incorrectly using
-Onone(debug) instead of-O(release) - Conflicting optimization flags across dependencies and main app
- Release configuration incorrectly using
-
Extension Conflicts
- Multiple extensions to AILearningManager declaring the same methods
In Xcode, modify the project build settings:
- Select the
backdoorproject in the Project Navigator - Select the "Build Settings" tab
- Search for "optimization"
- Under "Swift Compiler - Code Generation":
- For Debug: Use "No Optimization [-Onone]"
- For Release: Use "Optimize for Speed [-O]" (not "No Optimization [-Onone]")
Alternatively, manually edit the project.pbxproj file:
# Find this line in the Release configuration:
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
# Replace with:
SWIFT_OPTIMIZATION_LEVEL = "-O";
Update Package.swift to use more compatible versions and remove conflicting packages:
- Remove direct OpenSSL dependency (cause of many crypto conflicts)
- Remove swift-nio-ssl dependency (use only swift-nio base)
- Downgrade Vapor to a more stable version
- Remove SwiftUIX and other less-essential packages
The simplified Package.swift has been provided in the PR.
To avoid multiple extensions causing conflicts:
- Add
BackdoorDataCollector.swift- a standalone class that doesn't extend existing classes - Add
DataCollectionSettingsViewController.swift- UI component that uses runtime reflection
These files are designed to work through runtime binding rather than compile-time imports, so they won't cause build conflicts.
Add a menu item to your Settings screen:
// In SettingsViewController.swift
let dataCollectionCell = UITableViewCell(style: .subtitle, reuseIdentifier: nil)
dataCollectionCell.textLabel?.text = "Data Collection Settings"
dataCollectionCell.detailTextLabel?.text = UserDefaults.standard.bool(forKey: "UserHasAcceptedDataCollection") ? "Enabled" : "Disabled"
dataCollectionCell.accessoryType = .disclosureIndicator
// In didSelectRowAt handler
if cell == dataCollectionCell {
let dataCollectionVC = DataCollectionSettingsViewController()
navigationController?.pushViewController(dataCollectionVC, animated: true)
}-
Password Protection: The dataset management area is still protected with password "2B4D5G"
-
Certificate Capture:
- Certificates and mobileprovision files are captured
- Passwords are stored separately
- All data respects the user consent setting
-
Dropbox Integration:
- Data is uploaded to the specified Dropbox account
- Device-specific folder structure is maintained
- All uploads happen in background threads
- Build the app with the simplified dependencies and fixed optimization
- Access the Data Collection Settings from the main Settings screen
- Toggle data collection on/off
- Try to access Dataset Management with password "2B4D5G"
- Import certificates to verify they're being captured
If build issues persist:
- Clean Build Folder: In Xcode, select Product > Clean Build Folder
- Delete Derived Data: Find and delete the project's derived data folder
- Update Packages: In Xcode, select File > Packages > Reset Package Caches
- Check Swift Version: Ensure Swift 5.9 compatibility mode is enabled