FLEX Deployment and Usage Guide
Prerequisites
- iOS Development Environment: Xcode 9.0 or later
- macOS: macOS 10.13 or later
- iOS: iOS 9.0 or later
- Swift/Objective-C: Compatible with both languages
- CocoaPods (optional): For dependency management
- Carthage (optional): For dependency management
Installation
Using CocoaPods (Recommended)
- Add FLEX to your
Podfile:
pod 'FLEX', '~> 2.4'
- Run the installation command:
pod install
- Open your workspace file (
.xcworkspace) in Xcode.
Using Carthage
- Add FLEX to your
Cartfile:
github "Flipboard/FLEX" ~> 2.4
- Run Carthage to build the framework:
carthage update --platform iOS
- Drag the built
FLEX.frameworkinto your Xcode project.
Manual Installation
- Clone the repository:
git clone https://github.com/Flipboard/FLEX.git
- Add the FLEX source files to your Xcode project.
Configuration
Enabling FLEX in Debug Builds
To ensure FLEX is only available in debug builds, wrap the import and usage in preprocessor directives:
#if DEBUG
#import "FLEXManager.h"
#endif
Showing FLEX Programmatically
Add a gesture recognizer or debug menu item to trigger FLEX:
- (void)handleSixFingerQuadrupleTap:(UITapGestureRecognizer *)tapRecognizer
{
#if DEBUG
if (tapRecognizer.state == UIGestureRecognizerStateRecognized) {
[[FLEXManager sharedManager] showExplorer];
}
#endif
}
Simulator Keyboard Shortcuts
FLEX includes default keyboard shortcuts for the simulator:
f: Toggle FLEX toolbar?: Show help for all shortcuts
You can register custom shortcuts:
[FLEXManager.sharedManager registerSimulatorShortcutWithKey:'d'
modifiers:NSShiftKeyMask
action:@selector(yourActionMethod)
description:@"Your custom action"];
Build & Run
Development
- Open your Xcode project or workspace.
- Ensure the target is set to your app.
- Select a simulator or connected device.
- Build and run using
Cmd+Ror the Run button.
Testing FLEX
- Build and run your app in the simulator.
- Use the
fkey to toggle the FLEX toolbar. - Explore the various debugging tools available.
Production Considerations
- Remove FLEX: Ensure FLEX is disabled or removed from release builds using the
#if DEBUGpreprocessor directive. - Performance: FLEX may impact app performance; use it only during development.
Deployment
iOS App Store
Since FLEX is a development tool, it should not be included in App Store builds. Use conditional compilation to exclude it:
#if DEBUG
// FLEX code here
#endif
Enterprise Distribution
For enterprise builds, follow the same approach as App Store distribution to exclude FLEX from release builds.
Troubleshooting
Common Issues and Solutions
FLEX Not Showing Up
Issue: FLEX toolbar doesn't appear when pressing f in the simulator.
Solution:
- Ensure you're running in the simulator, not on a physical device.
- Verify that the
#if DEBUGdirective is correctly wrapping FLEX imports and usage. - Check that your keyboard focus is on the simulator window.
Build Errors with CocoaPods
Issue: Build fails with CocoaPods integration.
Solution:
- Run
pod repo updateto ensure your CocoaPods repository is up to date. - Delete the
Podfile.lockandPodsdirectory, then runpod installagain. - Ensure you're opening the
.xcworkspacefile, not the.xcodeproj.
Carthage Build Failures
Issue: Carthage fails to build FLEX.
Solution:
- Ensure Carthage is installed:
brew install carthage - Run
carthage update --platform iOS --no-use-binariesto force a fresh build. - Check for any missing dependencies in your
Cartfile.
FLEX Crashes on Launch
Issue: App crashes when trying to show FLEX.
Solution:
- Verify that FLEX is properly linked in your project settings.
- Check for any conflicts with other debugging tools.
- Ensure you're using a compatible version of FLEX with your iOS version.
Network History Not Working
Issue: Network requests are not appearing in FLEX.
Solution:
- Ensure network debugging is enabled in FLEX settings.
- Verify that your app is using
NSURLSessionorNSURLConnectionfor network requests. - Check that the requests are not being made before FLEX is initialized.
Memory Issues with Heap Explorer
Issue: Heap explorer causes memory warnings or crashes.
Solution:
- Limit the number of objects displayed in the heap explorer.
- Use the heap explorer sparingly, especially with large apps.
- Ensure your app has sufficient memory available before using this feature.
File Browser Not Showing Files
Issue: File browser is empty or missing expected files.
Solution:
- Verify that the files exist in your app's sandbox.
- Check file permissions and ensure FLEX has access to the directories.
- Look for any filters that might be hiding files.
SQLite Browser Issues
Issue: SQLite database files are not being recognized.
Solution:
- Ensure the database files have
.dbor.sqliteextensions. - Verify that the files are not corrupted.
- Check that the database is not currently locked by another process.
Realm Database Support
Issue: Realm databases are not being recognized.
Solution:
- Ensure you have Realm integrated into your project.
- Verify that the Realm files have the correct
.realmextension. - Check that the Realm files are not encrypted or otherwise inaccessible.
Keyboard Shortcuts Not Working
Issue: Custom keyboard shortcuts are not responding.
Solution:
- Verify that the shortcut keys are not already in use by the system or Xcode.
- Ensure the modifiers (Shift, Command, etc.) are correctly specified.
- Check that the action method exists and is properly implemented.
FLEX Toolbar Overlapping UI
Issue: FLEX toolbar covers important parts of your app's UI.
Solution:
- Adjust the FLEX toolbar position in the settings.
- Use the
FLEXManagerAPI to programmatically control FLEX visibility. - Consider using FLEX in a secondary window or modal presentation.
Performance Impact
Issue: App performance degrades when FLEX is active.
Solution:
- Use FLEX only during development and disable it in release builds.
- Limit the use of resource-intensive features like the heap explorer.
- Consider using FLEX in a separate debug build configuration.
Integration with Other Debugging Tools
Issue: Conflicts with other debugging tools like Xcode's view debugger.
Solution:
- Disable conflicting tools when using FLEX.
- Use FLEX and other tools in separate debugging sessions.
- Check for any overlapping functionality and use one tool at a time.
Updating FLEX
Issue: Need to update to a newer version of FLEX.
Solution:
- For CocoaPods: Update your
Podfileto the desired version and runpod update. - For Carthage: Update your
Cartfileand runcarthage update. - For manual installation: Replace the FLEX source files with the newer version.
Contributing to FLEX
Issue: Want to contribute to FLEX development.
Solution:
- Fork the repository on GitHub.
- Make your changes and ensure they pass the existing tests.
- Submit a pull request with a clear description of your changes.
By following this guide, you should be able to successfully integrate, use, and troubleshoot FLEX in your iOS development workflow. Remember to use FLEX responsibly and only in development environments to avoid any issues in production apps.