iOS
Requirements
Section titled “Requirements”- macOS with Xcode installed
xcrun simctlcommand-line tools- Flutter app built for simulator with
--dart-define=PROBE_AGENT=true - Physical devices only:
iproxyfromlibimobiledevicefor USB port forwarding (see Physical Device Setup below)
Simulator Setup
Section titled “Simulator Setup”List available simulators
Section titled “List available simulators”probe device listxcrun simctl list devices availableBoot a simulator
Section titled “Boot a simulator”probe device start --platform iosOr manually:
xcrun simctl boot <UDID>Build and install your app
Section titled “Build and install your app”flutter build ios --debug --simulator --dart-define=PROBE_AGENT=truexcrun simctl install <UDID> build/ios/iphonesimulator/YourApp.appxcrun simctl launch <UDID> com.example.myappFor cases where Xcode SDK and simulator iOS versions differ, use xcodebuild directly:
xcodebuild -workspace ios/Runner.xcworkspace \ -scheme Runner \ -sdk iphonesimulator \ -configuration Debug \ -destination 'platform=iOS Simulator,id=<UDID>' \ DART_DEFINES=$(echo 'PROBE_AGENT=true' | base64) \ -derivedDataPath build/ios \ buildPhysical Device Setup
Section titled “Physical Device Setup”Testing on a physical iOS device requires USB port forwarding because, unlike simulators, physical devices do not share the host’s loopback network. FlutterProbe uses iproxy (from the libimobiledevice suite) to forward the agent’s WebSocket port over USB.
Install iproxy
Section titled “Install iproxy”brew install libimobiledevice # macOSVerify the installation:
iproxy --helpHow it works
Section titled “How it works”When targeting a physical device, the CLI runs iproxy <host-port> <device-port> -u <UDID> to create a TCP tunnel over USB. The CLI then connects to ws://127.0.0.1:<host-port>/probe?token=... just like it would for a simulator.
Connection Flow (Simulator)
Section titled “Connection Flow (Simulator)”The iOS simulator shares the host’s localhost network. No port forwarding is needed.
- The CLI connects directly to
ws://127.0.0.1:<port>/probe?token=... - Token is read via fast path: file at
~/Library/Developer/CoreSimulator/Devices/<UDID>/data/tmp/probe/token - If the file is not available, the fallback streams simulator logs with
xcrun simctl spawn <UDID> log streamand parsesPROBE_TOKEN=lines - The ProbeAgent prints the token every 3 seconds to handle late-connecting CLI instances
Permissions
Section titled “Permissions”iOS simulator permissions are managed via xcrun simctl privacy:
allow permission "notifications" # simctl privacy grant <UDID> notifications <bundleID>deny permission "camera" # simctl privacy revoke <UDID> camera <bundleID>grant all permissionsrevoke all permissionsThis works on iOS 14+ simulators.
Video Recording
Section titled “Video Recording”iOS simulator video is recorded via xcrun simctl io <UDID> recordVideo. Videos use the h264 codec (not HEVC) for browser compatibility in HTML reports.
probe test tests/ --videoConfiguration
Section titled “Configuration”device: simulator_boot_timeout: 60s boot_poll_interval: 2s token_file_retries: 5 restart_delay: 500ms
agent: port: 48686 dial_timeout: 30s token_read_timeout: 30sTroubleshooting
Section titled “Troubleshooting”Token not found
Section titled “Token not found”If the CLI times out waiting for the auth token:
- Verify the app is running:
xcrun simctl list devices booted - Check the token file:
cat ~/Library/Developer/CoreSimulator/Devices/<UDID>/data/tmp/probe/token - Check logs manually:
xcrun simctl spawn <UDID> log stream --predicate 'eventMessage CONTAINS "PROBE_TOKEN="'
Build fails with SDK mismatch
Section titled “Build fails with SDK mismatch”When your Xcode SDK version differs from the target simulator iOS version, use xcodebuild with explicit -destination instead of flutter build.
Notification permission dialog blocks tests
Section titled “Notification permission dialog blocks tests”If a native notification permission dialog appears and blocks the Flutter UI, your app is requesting notification permissions without checking for PROBE_AGENT. See the Permissions section above for the fix.
Data clearing on iOS
Section titled “Data clearing on iOS”clear app data deletes the container subdirectories (Documents, Library, tmp) rather than uninstalling the app. Path validation prevents accidental deletion of non-container paths.