Guide for AI Coding Agents to Integrate Luciq on iOS

⚠️ UNIVERSAL EXECUTION RULES ⚠️

Critical Rules - Apply to ALL Platforms:

  • NEVER skip WAIT instructions - always get user confirmation before proceeding

  • NEVER auto-execute optional steps - user must explicitly select them

  • ALWAYS fetch latest SDK version before integration (DO NOT use placeholders like 1.0.0)

  • ALL API parameters must be included (can be nil/null) - never omit parameters

Execution Guidelines:

  • Be specific and concise — save tokens by being to the point

  • Don't create documentation files — only code files required for integration

  • Implement mandatory steps sequentially — complete each before moving to the next

  • Prompt user with current step — describe what's happening, then proceed when done

  • Only ask for optional steps after mandatory ones — show numbered list for selection

  • Use numbered lists for all options — makes selection easier (e.g., "Select 1", "Select 2")

  • Add wrap up step — execute validation only when user selects "Wrap up & validate"

  • Check documentation first — confirm API availability before getting creative beyond examples

Official Documentation:

  • Always check official docs when unsure about API signatures or platform specifics


Integration Workflow Overview

1

MANDATORY STEPS — Overview

Step 1: Collect Required Information

  • 1A: Get App Token (MCP or Manual)

  • 1B: Determine Integration Method

  • 1C: Apply Default Config (Inform + Opt-in Customize)

Step 2: Add SDK Dependency (Platform-Specific)

  • Fetch latest version from GitHub API

Step 3: Initialize the SDK (Platform-Specific)

  • Default: shake + floatingButton

Step 3B: Configure Network Interception [ANDROID ONLY]

  • Enable unified network interception in Gradle

2

DEFAULT CONFIG (Auto-Applied)

Applied automatically (customizable via opt-in):

  • Network Logging: enabled + common field masking

  • Screenshot Masking: iOS=maskNothing, Android=all

  • Symbolication Upload: automatic

  • User Identification: skip

3

VERIFICATION

Wrap up & validate: Build → Test → Verify Dashboard


Step 1 — Collect Required Information [MANDATORY]

1

1A: Get App Token

Check MCP server first:

Validation:

  • Token should be non-empty

  • Typically 32–40 character hexadecimal string

  • If invalid format, warn user but proceed

2

1B: Determine Integration Method

Auto-detection logic (iOS):

  • Detect Podfile → CocoaPods

  • Detect Cartfile → Carthage

  • Detect SPM packages in .xcodeproj → SPM

  • None → Manual

3

1C: Apply Default Configuration (Inform + Opt-in)

Default configuration is applied automatically. Inform the user:

Store default configuration:

If user chooses to customize, run the customization loop:

  1. Which setting to customize? (numbered list)

  2. WAIT for selection

  3. Apply customization

  4. Redisplay updated configuration

  5. Ask if they want to customize anything else — repeat until done

4

1D: Fastlane Detection (iOS only)

Auto-detection:


Step 2 — Add SDK Dependency [MANDATORY - iOS]

MUST FETCH LATEST VERSION FIRST: https://api.github.com/repos/luciqai/luciq-ios-sdk/releases/latest Extract version from "tag_name" (e.g., "19.1.0") and store it. DO NOT use placeholders like "1.0.0" or "latest".

1

If integration_method == spm (SPM - REQUIRED programmatic changes)

Important: When adding the SDK via SPM, you MUST update BOTH:

  • Package.swift

  • project.pbxproj

Xcode UI (manual) for reference:

  1. File → Add Package Dependencies...

  2. Enter URL: https://github.com/luciqai/luciq-ios-sdk

  3. Select "Exact Version" and enter <FETCHED_VERSION>

  4. Add "Luciq" product to your target

Programmatic changes (agent MUST modify project.pbxproj):

  • Add entries to PBXBuildFile, PBXFrameworksBuildPhase, PBXNativeTarget.packageProductDependencies, PBXProject.packageReferences.

  • Add XCRemoteSwiftPackageReference section with: repositoryURL = "https://github.com/luciqai/luciq-ios-sdk" requirement = { kind = exactVersion; version = <FETCHED_VERSION>; }

  • Add XCSwiftPackageProductDependency for productName = Luciq

Also update Package.swift:

ID generation notes:

  • Use unique 24-character hexadecimal IDs consistent with project file

Then run:

{% endstep %}

{% step %}

If integration_method == carthage

Add to Cartfile:

Then run:

{% endstep %}

{% step %}

If integration_method == manual (XCFramework)

  1. Download: https://github.com/luciqai/luciq-ios-sdk/releases/latest/download/Luciq-XCFramework.zip

  2. Unzip to reveal Luciq.xcframework

  3. Drag into Xcode project → Frameworks, Libraries, and Embedded Content

  4. Select "Embed & Sign" {% endstep %} {% endstepper %}


Step 3 — Initialize the SDK [MANDATORY - iOS]

ALWAYS use import LuciqSDK (NOT import Luciq) SDK initialization MUST be the FIRST line in init()/didFinishLaunchingWithOptions. Use exact SPM version requirement when adding package.

{% stepper %} {% step %}

Where to place initialization

  • SwiftUI: App struct's init() — AS THE FIRST LINE

  • UIKit: AppDelegate's application(_:didFinishLaunchingWithOptions:) — AS THE FIRST LINE

Examples:

SwiftUI

UIKit (AppDelegate)

{% endstep %}

{% step %}

Invocation Events Syntax

Default invocation events: [.shake, .floatingButton]

Examples:

Mapping:

  • none → []

  • single → [selected]

  • multiple → [event1, event2, ...] {% endstep %}

{% step %}

Step 3B — Add Info.plist Permissions

Fetch app name from Info.plist (CFBundleDisplayName or CFBundleName) or project.pbxproj (PRODUCT_NAME) and add if not present:

Implementation:

  1. Locate Info.plist

  2. Add NSMicrophoneUsageDescription if missing

  3. Add NSPhotoLibraryUsageDescription if missing

  4. Inform user of added permissions

Mask Sensitive Data (AFTER Luciq.start()) — SwiftUI example:

Recursive helper (as provided earlier) must handle dictionaries and arrays.

Key points:

  • Masking MUST be configured AFTER Luciq.start()

  • Use Sets for performance

  • Handle nested JSON recursively


Optional Step 2 — Mask Repro Step Screenshots (iOS)

Default: .maskNothing

API examples:

Available mask types:

  • .maskNothing

  • .textInputs

  • .labels

  • .media

SwiftUI auto-masking:

  • Changing masked types from .maskNothing automatically masks SwiftUI views

  • To disable auto-masking: Luciq.autoMaskSwiftUIViews = false

Present a numbered menu for the user to select which elements to mask (1–7 as in original workflow). WAIT for selection.


Optional Step 3 — Configure Repro Steps Mode (iOS)

Present a multiple-selection menu:

  1. Bug Reporting

  2. Crash Reporting

  3. Session Replay

  4. All products

  5. None

  6. Keep defaults

Apply mapping:

Selected → .enable (with screenshots) Not selected → .enabledWithNoScreenshots (without screenshots)

WAIT for user input and apply platform-specific calls accordingly.


Optional Step 4 — Add User Identification (iOS)

Present numbered choices:

  1. Using email

  2. Using user ID

  3. Using both email and ID

  4. Skip

If user skips, end flow. Otherwise, identify login/logout flows and instrument:

Identify after successful authentication and before navigation:

Examples:

  • Email only: Luciq.identifyUser(withID: nil, email: user.email, name: user.name)

  • ID only: Luciq.identifyUser(withID: user.id, email: nil, name: user.name)

  • Both: Luciq.identifyUser(withID: user.id, email: user.email, name: user.name)

Logout call (call BEFORE clearing session/data):

WAIT for user to confirm placements and apply code.


Optional Step 5 — Upload dSYM Files (iOS)

This step is configured automatically based on Fastlane detection (Step 1D). Present options:

  1. Automatic (recommended) — Fastlane plugin or Run Script Build Phase

  2. Manual — upload through dashboard

  3. Skip

If Fastlane detected (fastlane_detected == true) — Fastlane plugin approach:

In Fastfile (archive lane):

Plugin params:

  • api_token (required)

  • dsym_array_paths (required for local archives)

  • eu (optional)

  • end_point (optional)

If Fastlane not detected — add Run Script Build Phase (agent MUST modify project.pbxproj):

Add a PBXShellScriptBuildPhase named "Upload dSYM to Luciq" with shellScript:

Notes:

  • Use exit 0 when script not found to avoid build failures

  • Replace <APP_TOKEN> with token from Step 1A

Agent must add the build phase to PBXNativeTarget.buildPhases as LAST item.


Step 4 — Verification & Testing (Wrap up & validate) [USER-INITIATED ONLY]

This step must only run when the user explicitly selects "Wrap up & validate".

Display summary and options:

WAIT for selection. Do NOT proceed to build verification unless user selects option 2.

Build Verification (Only when requested)

Run iOS build verification command:

Expected: ** BUILD SUCCEEDED **

Common iOS build errors and fixes:

  • "no such module 'Luciq'" → used import Luciq instead of import LuciqSDK

  • "version not found" → invalid SPM version — verify releases/latest

  • "Missing package product 'Luciq'" → add "Luciq" product to target

Runtime Testing (Manual)

  1. Build and run the app on simulator/device

  2. Trigger Luciq using configured invocation method:

    • Shake: Hardware → Shake (Cmd+Ctrl+Z in simulator)

    • Screenshot: take screenshot

    • Floating Button: tap overlay

  3. Verify Luciq UI appears

  4. Submit test bug report

  5. Check Luciq dashboard: https://dashboard.luciq.ai

Final Summary (after successful validation)

Display:


Error Handling & Troubleshooting (iOS highlights)

  1. SDK Not Initializing

    • Verify token is correct

    • Check initialization code placement (App entry point)

    • Ensure import LuciqSDK is used

  2. Network Logging Not Working

    • Ensure masking code is after Luciq.start()

    • Confirm NetworkLogger is available via import LuciqSDK

  3. User Identification Not Showing

    • Verify identifyUser called after successful login and not with all nil params

  4. Reports Not Appearing in Dashboard

    • Check internet, app token, and dashboard filters

iOS-specific errors:

  • "Command SwiftCompile failed" — check imports and syntax (import LuciqSDK)

  • "Fastlane dSYMs file is not found!" — ensure dsym_array_paths parameter when using local archives


iOS Quick Reference

Last updated