---
name: ansight-migrate-sdk-1-1-ios
description: Migrate a native SwiftUI or UIKit app from an older Ansight pairing-config integration to SDK 1.1 zero-touch developer enrollment. Use when upgrading SwiftPM or CocoaPods, deleting bundled pairing JSON, host settings, signing or certificate setup, replacing manual connection startup, or adding generic physical-device QR enrollment with minimal Apple privacy declarations.
---

# Migrate iOS to Ansight SDK 1.1

Upgrade the app to automatic Simulator enrollment and one-use physical-device
QR enrollment. Remove the old pairing-config path completely.

## Migration

1. Identify the app target, bundle id, startup delegate, dependency manager,
   development configuration, and existing Ansight connection code.
2. Upgrade the aggregate SwiftPM dependency:

```swift
.package(
    url: "https://github.com/ansight-ai/ansight-sdk.git",
    exact: "1.3.0-preview.10"
)
```

   For CocoaPods, use:

```ruby
pod "Ansight", "1.3.0-preview.10"
```

3. Delete pairing JSON resources, build phases, environment variables, host and
   Wi-Fi settings, signing keys, certificate configuration, and desktop-host probes.
4. Remove code that reads or passes a pairing configuration. Do not keep a
   legacy file or manual-host fallback.
5. Initialize the aggregate SDK once:

```swift
try AnsightRuntime.shared.initializeAndActivateAnsightSdk()
```

6. Add a developer-only physical-device action:

```swift
let result = await AnsightRuntime.shared.connect(
    .qrCode(title: "Scan Ansight Enrollment QR")
)
```

7. Keep reflection, secure-storage access, writes, and deletes disabled unless
   the development workflow explicitly needs them.

## Enrollment behavior

- iOS Simulator and Mac Catalyst connect automatically to a running CLI host
  on the same Mac.
- A physical iPhone scans the generic QR from `ansight pairing issue --qr` once;
  the SDK supplies its real App ID and does not require prior registration.
- The SDK stores a random installation id and enrollment state privately and
  reconnects on later launches.

## Privacy declarations

Add `NSCameraUsageDescription` only when the SDK QR scanner is exposed. Add
`NSLocalNetworkUsageDescription` for direct physical-device access to the CLI host.
Do not add Bluetooth, location, contacts, photos, Bonjour, associated domains,
or an ATS clear-text exception. The SDK uses Network.framework for its local
development connection.

## Verification

Resolve dependencies and build the relevant Simulator target. When practical,
also build and run on a physical device. Verify:

- no pairing resource appears in the app bundle;
- Simulator startup connects without a QR;
- one generic QR scan connects a physical device; and
- a second launch reconnects automatically.

Confirm the live session with `ansight session list --connected --app-id <app-id> --json`.
