-
Notifications
You must be signed in to change notification settings - Fork 0
iOS Integration Guide
pbertsch edited this page Mar 21, 2026
·
1 revision
# pubspec.yaml
dev_dependencies:
probe_agent:
path: ../FlutterProbe/probe_agent # or from pub.devimport 'package:probe_agent/probe_agent.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
const probeEnabled = bool.fromEnvironment('PROBE_AGENT');
if (probeEnabled) {
await ProbeAgent.start();
}
// IMPORTANT: Guard notification permissions
if (!probeEnabled) {
await requestNotificationPermission();
await FirebaseMessaging.instance.requestPermission();
}
runApp(const MyApp());
}flutter run --debug --dart-define=PROBE_AGENT=true \
-d <simulator-UDID>project:
app: com.example.myapp # Your bundle ID
agent:
port: 48686
defaults:
platform: iosFlutterProbe pre-grants supported permissions via xcrun simctl privacy:
| Permission | simctl Service | Supported |
|---|---|---|
| Camera | camera |
Yes |
| Microphone | microphone |
Yes |
| Location | location |
Yes |
| Photos | photos |
Yes |
| Contacts | contacts-limited |
Yes |
| Calendar | calendar |
Yes |
| Notifications | - | No (Apple limitation) |
Since notifications cannot be pre-granted, your app MUST skip notification permission requests when PROBE_AGENT=true. See Troubleshooting.
The ProbeAgent writes a token file to the app container:
<container>/tmp/probe/token
The CLI resolves this via:
xcrun simctl get_app_container <UDID> <bundleID> dataThe token is a 32-character random string, printed to logs every 3 seconds as fallback.
clear app data on iOS:
- Terminates the app
- Deletes
Documents/,Library/,tmp/from the app container - Resets the simulator Keychain (
xcrun simctl keychain <UDID> reset) - Re-grants permissions
- Relaunches the app
Note: Keychain reset affects ALL apps on the simulator, not just the target app.
iOS simulator videos use xcrun simctl io recordVideo with --codec=h264 for browser compatibility in HTML reports.
If Xcode SDK version differs from the simulator's iOS version, flutter run may fail. Workaround:
xcodebuild -project Runner.xcodeproj \
-scheme Runner \
-destination 'platform=iOS Simulator,id=<UDID>' \
buildWith DART_DEFINES:
DART_DEFINES=$(echo 'PROBE_AGENT=true' | base64)
xcodebuild ... GCC_PREPROCESSOR_DEFINITIONS='$(inherited)' DART_DEFINES="$DART_DEFINES"project:
app: com.example.myapp
agent:
port: 48686
dial_timeout: 30s
token_read_timeout: 30s
reconnect_delay: 2s
device:
simulator_boot_timeout: 60s
defaults:
platform: ios
timeout: 30s
grant_permissions_on_clear: true
video:
resolution: 720x1280
framerate: 2