AppleDev.FbIdb
0.8.10
dotnet add package AppleDev.FbIdb --version 0.8.10
NuGet\Install-Package AppleDev.FbIdb -Version 0.8.10
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AppleDev.FbIdb" Version="0.8.10" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AppleDev.FbIdb" Version="0.8.10" />
<PackageReference Include="AppleDev.FbIdb" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AppleDev.FbIdb --version 0.8.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AppleDev.FbIdb, 0.8.10"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AppleDev.FbIdb@0.8.10
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AppleDev.FbIdb&version=0.8.10
#tool nuget:?package=AppleDev.FbIdb&version=0.8.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
AppleDev.FbIdb
A C# client library for Facebook's IDB (iOS Development Bridge) companion, providing a full .NET API for controlling iOS simulators and devices.
Features
- Complete gRPC API Coverage: Wraps all IDB companion gRPC methods
- Companion Process Management: Automatically manages the idb_companion process lifecycle
- Flexible Binary Location: Supports bundled binary, Homebrew installation, or custom paths
- Async/Await Support: Fully asynchronous API with
CancellationTokensupport - Streaming Support: Handles streaming operations for logs, video, and test results
- Strong Typing: All API responses mapped to strongly-typed C# models
Requirements
- macOS (required - IDB only works on macOS)
- .NET 8.0 or later
- Xcode with iOS Simulator support
- idb_companion binary (installed via Homebrew or bundled)
Installation
Install idb_companion via Homebrew (Recommended)
brew tap facebook/fb
brew install idb-companion
Install NuGet Package
dotnet add package AppleDev.FbIdb
Quick Start
using AppleDev.FbIdb;
using AppleDev.FbIdb.Models;
// Create a client for a specific simulator UDID
await using var client = new IdbClient("SIMULATOR-UDID-HERE");
// Connect to the companion
await client.ConnectAsync();
// Get target information
var description = await client.DescribeAsync();
Console.WriteLine($"Connected to: {description.Name} ({description.OsVersion})");
// List installed apps
var apps = await client.ListAppsAsync();
foreach (var app in apps)
{
Console.WriteLine($" {app.BundleId} - {app.Name}");
}
// Take a screenshot
var screenshot = await client.ScreenshotAsync();
await File.WriteAllBytesAsync("screenshot.png", screenshot.ImageData);
// Set simulated location
await client.SetLocationAsync(37.7749, -122.4194); // San Francisco
API Overview
Connection & Management
ConnectAsync()- Connect to the companionDescribeAsync()- Get target descriptionLogAsync()- Stream device/companion logs
App Lifecycle
InstallAsync()- Install apps, xctest bundles, dylibs, dsyms, frameworksUninstallAsync()- Uninstall an appLaunchAsync()- Launch an app with arguments and environmentTerminateAsync()- Terminate a running appListAppsAsync()- List installed apps
Media & Screenshots
ScreenshotAsync()- Take a screenshot (automatically falls back to simctl for simulators)AddMediaAsync()- Add photos/videos to the device
Interaction (HID)
TapAsync()- Tap at a pointSwipeAsync()- Perform swipe gesturePressButtonAsync()- Press hardware buttons (Home, Lock, etc.)SendKeyAsync()- Send keyboard inputFocusAsync()- Focus the simulator window
Settings & Permissions
ApprovePermissionAsync()- Grant app permissionsRevokePermissionAsync()- Revoke app permissionsSetSettingAsync()/GetSettingAsync()- Manage device settingsSetHardwareKeyboardAsync()- Enable/disable hardware keyboardClearKeychainAsync()- Clear the keychainSetLocationAsync()- Set simulated GPS location
File Operations
ListFilesAsync()- List directory contentsMakeDirAsync()- Create directoriesPushAsync()/PullAsync()- Transfer files to/from deviceMoveAsync()/RemoveAsync()- Move/delete files
Crash Logs
ListCrashLogsAsync()- List crash logsGetCrashLogAsync()- Get crash log contentsDeleteCrashLogsAsync()- Delete crash logs
XCTest
ListTestBundlesAsync()- List installed test bundlesListTestsAsync()- List tests in a bundleRunTestsAsync()- Run tests and get resultsRunTestsStreamAsync()- Stream test results as they complete
Notifications & Misc
SendNotificationAsync()- Send push notificationsOpenUrlAsync()- Open a URLSimulateMemoryWarningAsync()- Trigger memory warning
Configuration
var options = new IdbCompanionOptions
{
// Use a custom companion binary path
CompanionPath = "/path/to/idb_companion",
// Specify a fixed gRPC port (0 = auto-assign)
GrpcPort = 0,
// Adjust timeouts
StartupTimeout = TimeSpan.FromSeconds(30),
OperationTimeout = TimeSpan.FromSeconds(60),
// Enable verbose logging
VerboseLogging = true
};
await using var client = new IdbClient("UDID", options);
Environment Variable
You can also set the companion path via environment variable:
export IDB_COMPANION_PATH=/path/to/idb_companion
Connecting to Existing Companion
If you have an idb_companion already running:
// Connect to an existing gRPC server
var client = IdbClient.ConnectToExisting("http://localhost:12345");
Running XCTests
var request = new XctestRunRequest
{
TestBundleId = "com.example.MyAppTests",
Mode = new XctestMode.Application("com.example.MyApp"),
CollectCoverage = true,
ReportActivities = true
};
var result = await client.RunTestsAsync(request);
Console.WriteLine($"Status: {result.Status}");
foreach (var test in result.Results)
{
var status = test.Status == TestStatus.Passed ? "✓" : "✗";
Console.WriteLine($" {status} {test.FullName} ({test.Duration:F2}s)");
}
Streaming Test Results
await foreach (var test in client.RunTestsStreamAsync(request))
{
Console.WriteLine($"[{test.Status}] {test.FullName}");
}
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Facebook IDB - The underlying iOS Development Bridge
- gRPC - High-performance RPC framework
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Google.Protobuf (>= 3.29.3)
- Grpc.Net.Client (>= 2.67.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
-
net8.0
- Google.Protobuf (>= 3.29.3)
- Grpc.Net.Client (>= 2.67.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.